Re: help with callbacks
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: help with callbacks
- From: Merick <Merick_TeVaran@...>
- Date: 2007年8月19日 12:54:25 -0500
Luiz Henrique de Figueiredo wrote:
If the callback registration function doesn't take a data pointer, you
have to store it in a global variable.
Or you can register a single C function as callback and then map widgets
to Lua handlers via a table in the registry for instance.
After working on this some more I think I've come up with something
The gui lib I'm using sends arguments to the callback function, and one
of them is a pointer. In FreeBasic most (but not all) pointers are just
an integer, so I'm thinking that it might be possible to store the
results from lua_ref() into a hash table using that number as the key,
then in the callback function I would be able to use that hashtable with
lua_getref and pcall to run the function from the script