nginx_lua module provides an API that can be called in the Lua code to interact with other NGINX components. The complete API is exposed in the form of two packages, namely,
ndk. These packages are available within the
ngx_lua directive and can be imported in external Lua modules using the
require statements. The API has been integrated into the NGINX event loop, so all I/O operations in the Lua code must be performed using the exposed API to avoid performance bottlenecks.
The complete API is quite comprehensive and provides methods to interact with every feature of NGINX. It is available at http://wiki.nginx.org/HttpLuaModule#Nginx_API_for_Lua. The following section provides an overview of the exposed API.