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:
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user