Overview of lua-resty-core
masterWhat is lua-resty-core?
lua-resty-core is a high-performance, FFI-based Lua API for the ngx_http_lua_module and ngx_stream_lua_module. It reimplements parts of the standard Nginx API for Lua using LuaJIT FFI.
Key Benefits
- Performance: Because it uses LuaJIT FFI, the API can be JIT-compiled, making it significantly faster than the standard Lua C API used by the default
ngx_luamodule. - Safety and Completeness: Provides a more robust and complete implementation of Nginx APIs.
- Compatibility: It installs the new FFI-based API into the existing
ngx.*andndk.*namespaces, meaning it acts as a drop-in replacement for many standard functions.
Usage Note
Since OpenResty 1.15.8.1, this library is automatically loaded by default. It is highly recommended to use the version bundled with your OpenResty release to avoid compatibility issues.