News for hackers. Stuff that matters.
Re:Nginx C function by shakna on Sunday October 14, 2018 @01:31AM (#18211525)
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

Re:Nginx C function by guipsp on Sunday October 14, 2018 @04:32AM (#18211954)
Why would you ever opt to go thru Lua in this case?
Re:Nginx C function by shakna on Sunday October 14, 2018 @08:07AM (#18212516)
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?

Re:Nginx C function by Hello71 on Sunday October 14, 2018 @09:25AM (#18212773)
This doesn't seem to support actually exporting C-compatible functions.
Re:Nginx C function by shakna on Sunday October 14, 2018 @06:12PM (#18215793)
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

Re:Nginx C function by annchin_peh on Friday October 19, 2018 @04:47AM (#18255167)
it's complicated