lua-users home
lua-l archive

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

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

~ Jeff