[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: again: problem with weak table and finalized objects
- From: Luis Carvalho <lexcarvalho@...>
- Date: Sun, 29 Aug 2010 19:23:49 -0400
> > If I understand correctly your problem is not that the entries in your table
> > are not collected when they're finalized, but that you're accessing already
> > finalized windows. One workaround is to include a flag to your window object
> > indicating if it has been finalized or not:
> >
> > for window, plot in pairs(weaktable) do
> > if window.isdone() then
> > -- do something
> > end
> > end
<snip>
> I think that what you are suggesting is not correct because if the
> object have been finalized by Lua any access to read any flag is a
> potential fault since the memory have been deallocated.
<snip>
My mistake; I meant:
for window, plot in pairs(weaktable) do
if not window.isdone() then
-- do what you want to do with window
end
end
Cheers,
Luis
--
Computers are useless. They can only give you answers.
-- Pablo Picasso
--
Luis Carvalho (Kozure)
lua -e 'print((("lexcarvalho@NO.gmail.SPAM.com"):gsub("(%u+%.)","")))'