[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: luajit ffi - calling a luajit function via a C function pointer?
- From: Shawn Fox <shawnkfox@...>
- Date: Wed, 9 Feb 2011 21:49:18 -0600
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.