Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 1.79 KB

core-constants.md

File metadata and controls

49 lines (33 loc) · 1.79 KB

核心常量

环境: init_by_lua*, set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua*, body_filter_by_lua, *log_by_lua*, ngx.timer.*

    ngx.OK (0)
    ngx.ERROR (-1)
    ngx.AGAIN (-2)
    ngx.DONE (-4)
    ngx.DECLINED (-5)

请注意,这些常量中只有三个可以被 Nginx API for Lua 使用 (即 ngx.exit 只接受 NGX_OK, NGX_ERROR, 和 NGX_DECLINED 作为输入)。

   ngx.null

ngx.null 常量是一个 NULL轻量用户数据,一般被用来表达 Lua table 等里面的 nil (空) 值,类似于 lua-cjson 库中的 cjson.null 常量。在v0.5.0rc5 版本中首次引入这个常量。

ngx.DECLINED 这个常量在v0.5.0rc19版本中首次引入。

English Source

context: init_by_lua*, set_by_lua*, rewrite_by_lua*, access_by_lua*, content_by_lua*, header_filter_by_lua*, body_filter_by_lua, *log_by_lua*, ngx.timer.*

   ngx.OK (0)
   ngx.ERROR (-1)
   ngx.AGAIN (-2)
   ngx.DONE (-4)
   ngx.DECLINED (-5)

Note that only three of these constants are utilized by the Nginx API for Lua (i.e., ngx.exit accepts NGX_OK, NGX_ERROR, and NGX_DECLINED as input).

   ngx.null

The ngx.null constant is a NULL light userdata usually used to represent nil values in Lua tables etc and is similar to the lua-cjson library's cjson.null constant. This constant was first introduced in the v0.5.0rc5 release.

The ngx.DECLINED constant was first introduced in the v0.5.0rc19 release.

返回目录