[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: table question
- From: "Michael Cumming" <Mike@...>
- Date: Mon, 26 Jul 2004 09:53:11 -0500
I am using Lua 4 and LuaCom. I would like to maintain a "master" table of all open objects. I have been playing around with some Lua code to see how tables are handled. The code below is a quick and dirty test of creating an object which is returned to the caller and also stored in a master table. I would like to be able to "destroy" the object by iterating the master table. But if I set an the object in the master table to to nil, the table returned to the caller still exists. Is there a way around this?
t = {} -- master list of open objects
function newobject ()
local o
o = {"test"} -- normally would be "creatobject"
tinsert (t,o)
return o
end
c = newobject ()
print (c)
print (t [1])
t [1] = nil
print (c)
print (t [1])
OUTPUT
table: 0157B360
table: 0157B360
table: 0157B360
nil
Thanks,
Mike
<<winmail.dat>>