Hacker News new | past | comments | ask | show | jobs | submit login

LuaJIT 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




Why would you ever opt to go thru Lua in this case?


It'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?


This doesn't seem to support actually exporting C-compatible functions.


Create 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


it's complicated




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: