For example, if e is LuaEntity object
i want to bind some data to e using like this : e.extra_data = my_private_data
when i regain this object in another place, i can return the private data : local my_private_data = e.extra_data
Could I associate extra data or private data for an entity object
Re: Could I associate extra data or private data for an entity object
Use the global object and the unit_number as the key.
Code: Select all
script.on_init(function()
global.extra_data = {}
end)
function set_data(e, my_private_data)
global.extra_data[e.unit_number] = my_private_data
end
function get_data(e)
return global.extra_data[e.unit_number]
end
Re: Could I associate extra data or private data for an entity object
thx, actually , i want a proerty of entity to store this data.
Re: Could I associate extra data or private data for an entity object
thx your reply. In old vb programs, mcrosoft using this tech for vb objects to store private data. That's why i ask this question