lua-users home
lua-l archive

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


How about adding the ability to get a function pointer back from luajit which would call a Lua function?  Something like this:

int (*func)(double, char *, int);
func = luajit_ffi_function(L, "LuaFunctionName", "int", "double, char*, int")
int x = *func(123.456, "foo", 1234)

The syntax of the above is a mess, but I just wanted to make it clear what I was asking for.  I think this could result in a big performance boost for code which has to make a large number of calls to a Lua funciton, assuming that it would be much faster than pushing a Lua function on the stack and then pushing the argument values on the stack and using lua_call or lua_pcall.