lua-users home
lua-l archive

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


See the manual entry for lua_ref()

Later on, you can use lua_getref and then lua_call to do what you want.

Eric

> -----Original Message-----
> From: owner-lua-l@tecgraf.puc-rio.br
> [mailto:owner-lua-l@tecgraf.puc-rio.br]On Behalf Of Kenneth Gangstoe
> Sent: Friday, November 16, 2001 5:25 PM
> To: Multiple recipients of list
> Subject: Storing function references
>
>
> Hi.
>
> I am in need of storing a reference to a Lua function in C, for later use.
>
> In Lua:
>
> function f() write("foo") end
>
> addEvent(10, f)
>
>
> The question becomes how do I at the C side (where addEvent is
> implemented)
> save a reference to 'f' so that I can call 'f' asynchronously 10 seconds
> later ?
>
> - Kenneth
>