[SOLVED] get_objects_inside_radius returns objs with no name
Hello
I am trying to dereference the name of an object obtained from get_objects_inside radius - but they do not seem to have a name property. Have I misunderstood how to extract the name at this stage, or is there really no name?
For the code in its context see https://github.com/taikedz/vivarium/blo ... #L346-L355
I am trying to dereference the name of an object obtained from get_objects_inside radius - but they do not seem to have a name property. Have I misunderstood how to extract the name at this stage, or is there really no name?
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
if pointed_thing.type ~= "node" then
if not pointed_thing.ref then return end
local mob = pointed_thing.ref
local mobe = mob:get_luaentity()
if mob:is_player() then return end
for _,obj in pairs(minetest.get_objects_inside_radius(mob:getpos() ,radius)) do
--if mobe.name == obj:get_luaentity().name then -- crashes, attempted index a nil value (name)
if mobe.name == obj:get_luaentity() then -- this produces debug showing the lua entity is indeed returned without a name
vivarium:bomf(obj:getpos(),1 )
obj:remove()
else
minetest.debug(mobe.name.." is not "..dump(obj:get_luaentity() ))
-- the debug shows it has no "name" property
-- note: mob.name is correctly set
end
end
return
end
For the code in its context see https://github.com/taikedz/vivarium/blo ... #L346-L355