I don't know Lua well enough to answer for Lua, but in at least one other language (that I do know well:-) I can answer it by creating a lexical closure; let the anonymous function capture a lexical variable that holds a copy of the reference to the anonymous function. -Bennett
Attachment:
pgpC7OemEVeQF.pgp
Description: PGP signature