我在 “/usr/local/openresty//lualib/resty/TS.lua” 创建了一个lua,内容如下
module(...)
local TS = {}
function TS:getTs()
local ts_str = os.date("%Y%m%d%H%M%S").."00"..string.sub(string.format("%14.3f",ngx.now()),12,14)
return ts_str
end
return TS
当我调用的时候提示如下
/usr/local/openresty//lualib/resty/TS.lua:6: attempt to index global 'os' (a nil value)
为什么是nil呢?