Lua struct obj improvements

If the core frees the obj struct referred by lua, don't free it,
just mark it as OBJ_LUAFREE - lua will free it in gc once all
the references to it are gone.
This commit is contained in:
Pasi Kallinen
2020-01-01 13:25:55 +02:00
parent 2ae7cf02ea
commit 7e07cef197
5 changed files with 58 additions and 30 deletions

View File

@@ -64,3 +64,21 @@ end
if (oc3.class ~= "*") then
error("object class is not *, part 3");
end
local oc4 = o:class();
if (oc4.name ~= "rock") then
error("object class is not rock, part 4");
end
if (oc4.class ~= "*") then
error("object class is not *, part 4");
end
-- placing obj into container even when obj is somewhere else already
local o5 = obj.new("dagger");
o5:placeobj(u.ux, u.uy);
box:addcontent(o5);
local o6 = obj.new("statue");
o6:addcontent(obj.new("spellbook"));