lua-users home
lua-l archive

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


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