lua-users home
lua-l archive

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


Hi,

I have a weak table I use in Tir to store the states of coroutines
that are in play, and I'd like to get a callback whenever an element
is removed from the table.  The usage I'm doing is pretty simple:

local STATE = setmetatable({}, {__mode="k"})

And then I put stuff in it.  Not that big of a deal, but what I'd like
is to add a function callback when something is collected out of it.

Any ideas on how to do that?  If it's not possible then I'll probably
ditch the weak table in favor of something I control myself.

Thanks,

Zed