lua-users home
lua-l archive

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


On Thu, Apr 14, 2011 at 7:23 AM, Michael Gogins
<michael.gogins@gmail.com> wrote:
> Thanks so much for the FFI metamethods. Can we anticipate "C" calling
> convention callbacks into LuaJIT+FFI code from non-Lua compiled code? Is
> there any way to hack this at this time?

The solution I ended up going with is to have a normal C module which
registers event listeners, and a function in that module to call to
get a list of events which took place. It works well enough for GLFW
events:

http://pastebin.com/iHa8c5CX

One call to registerEventListeners at the beginning of the program,
and calls to pollEvents in the event loop. pollEvents returns a table
with all the events that have happened since the last call.

I'd love to cut out the middleman and register the callbacks directly
from Lua, of course, but this works well in the meantime...

> Regards,
> Mike



-- 
Paul Bonser | http://probablyprogramming.com | @pib