On Monday, 23 May 2016 16:29:13 UTC+3, Romaboy wrote:
Okay, the long version then.
- Lua Nginx Module is C-code
- Lua Nginx Stream Module is C-code
Now there are two wayt to write bindings with LuaJIT (see _JIT_).
1. Normal stack based Lua C API (that usually needs a C-coded wrapper library)
2. LuaJIT FFI based API (that usually is plain Lua, but it may coma handy to provide a better suited C API for that)
Then let's look at OpenResty or Lua Nginx Module, it can be build with:
1. LuaJIT
2. PUC Lua
The first one is default. The second one cannot use LuaJIT FFI bindings.
By default there are PUC Lua bindings to those APIs that you said. Those are PUC Lua Bindings, but making this line in init_by_lua*:
You actually monkey patch the PUC Lua bindings and replace them with JITtable FFI bindings. That single line can provide you a nice performance boost. If you don't have that line, then you will be using PUC Lua bindings, and that will work too. Adding that line will only work with LuaJIT of course.
Some new features are probably only going to be supporting FFI, but the current ones are there for backward compatibility.
Does that explain you what is going on?