lua-users home
lua-l archive

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


Do you mean a lua_CFunction? Thats a function that has to be "exported" to lua with lua_register or similar
or you mean a regular C function?

for the first case you have the name in lua that can be used as function_name(1,2) for the second case you need ffi that you can get with luajit or in plain lua with any ffi module.

victor bombi

----- Original Message ----- From: Austin Einter
To: Lua mailing list
Sent: Friday, July 04, 2014 7:05 PM
Subject: Calling C functions from Lua Code


Hi All

I have a requirement as below.




1. From C code, call lua function ( I know how to do it)

2. While lua function is being executed,  call a C function

3. Lua function returns

4. C code completes and program terminates


Hope it should be possible.


Can somebody please help me how to implement above point 2 (how to call a C function from Lua).


Thanks

Austin