4 ms·
For one thing, you don't have to use this module with C. Any language that supports exporting C-compatible functions will do – there's C++ of course, but also
by comex 8y ago
For one thing, you don't have to use this module with C. Any language that supports exporting C-compatible functions will do – there's C++ of course, but also Rust, Go, D, Nim, and many many others.
- shakna 8y agoLuaJIT also supports C-functions. It's FFI [0] will allow you to declare any C-compatible function or data structure, and then use it in normal Lua code. [0] https://luajit.org/ext_ffi.html https://luajit.org/ext_ffi.html
- guipsp 8y agoWhy would you ever opt to go thru Lua in this case?
- shakna 8y agoIt's well supported, well maintained, and around for the foreseeable future. (OpenResty) The language implementation is fast, and allows you to tap into any C-compatible library. The question isn't why you would go through Lua, but why you would choose something with less support?
- Hello71 8y agoThis doesn't seem to support actually exporting C-compatible functions.
- shakna 8y agoCreate some Lua code that runs within C? Rather than just passing and converting to C values when needed? That's the role of the C API [0]. But usually you'd just be passing C up to Lua to bind it together. [0] https://luajit.org/ext_c_api.html https://luajit.org/ext_c_api.html
- annchin_peh 8y agoit's complicated