Nyarg wrote:I need help.
I create simple entity.
Now I need add to instance some metadata. How I may to do it ?
Next line I need read metadata. How I may to do it ?
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_on_punchnode
minetest.add_entity(proto) --- instance 1 of proto
minetest.add_entity(proto) --- instance 2
??? add some meta into instance 1
??? add some different meta into instance 2
??? read added meta from instance 1
end
add_entity() returns an ObjectRef
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
local object=minetest.add_entity(pos, name)
You can get it's luaentity (the lua table that is "self" in entity functions)
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
local luaentity=object:get_luaentity()
now you can write stuff into it.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
luaentity.foo="bar"
print(luaentity.bababap)