lua-users home
lua-l archive

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


Hi,


So far I've had only one issue, not being able to do callbacks (as
Mike explained lua ->  FFI ->  C ->  lua).

This probably doesn't solve this problem, but you can do something like this:

<code>
local ffi = require"ffi"

ffi.cdef(io.open('luadefs.h', "r"):read"*a")

local lua = ffi.load('./src/libluajit.so')
local state = lua.luaL_newstate()

lua.luaL_openlibs(state)
lua.luaL_loadstring(state, [[
   print("CHEESE!")
]])
lua.lua_call(state, 0, 0)
</code>

With a little C helper function you could return the current lua_State without the need to first do luaL_newstate. Now to figure out how to pass data back and forth :)

Cheers,
Richard