lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> > 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+%.)","")))'