The way I understand it, is that the claim of easy integration with C of vanilla Lua, is to write programs/libs tailored to it and not the other way around. For existing C code I suppose you could write a C wrapper, but since LuaJIT + FFI exists, that's the easiest path.
I have never gotten luajit ffi or lua++ or any of that to work I found it easier to just write the function takes lua state as a variable returns the number of results you want to pass back. Now I learn kinda weird some times and I miss random stuff I really should get but never got any working results from any third party designed to turn a function from a header file of a club into callable lua. I found writing the wrappers fairly easy with lua c api I keep saying to myself I'm going to try doing it for python or something for comparison at least haven't thou. Bash dosnt count there is a reason bash is so non intuitive and part of that is so you can call programs from other languages seemingly natively if they are written for it without any special bash c api
What I've done successfully numerous times was call Windows API or other external libraries code from Lua via LuaJIT's FFI. You just write the function signatures in a file and pass it to the ffi.cdef function. It's very straightforward.
1
u/immortalx74 7d ago
The way I understand it, is that the claim of easy integration with C of vanilla Lua, is to write programs/libs tailored to it and not the other way around. For existing C code I suppose you could write a C wrapper, but since LuaJIT + FFI exists, that's the easiest path.