[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Knowing about Lua conditional constructs (in C code)
- From: "Solinsky, Jeff - PAL" <Jeff.Solinsky@...>
- Date: Mon, 23 Jan 2012 13:28:25 -0500
Ani Wrote:
> Can I know that the functions are to be called in the /if/ context
> (and internally populate
> some C data structures for the same) ? ... hope I made the question clear.
> Is this possible in pure Lua, or I need some add-ons ?
If you are using standard Lua, you need a foreign function interface to call C functions that don't use the Lua stack for passing parameters and returning values.
Alien is a Lua add-on that allows you to call C functions and has support for buffers to manipulate C structures from Lua if you must do that.
LuaJIT has a fast function interface with support for creating and using C types built-in that is much faster than Alien and much easier for defining functions due to it's ability to parse C headers (though it has no C pre-parser support); however, LuaJIT ffi only works with LuaJIT (it isn't available for the c implementation of Lua from lua.org).
~ Jeff