本章内容来自 openresty 讨论组 [这里](https://groups.google.com/forum/#!topic/openresty/3 ylMdtvUJqg)先看两段代码: -- index.lualocal uri_args = ngx.req.get_uri_args()local mo = require('mo') mo.args = uri_args-- mo.lualocal showJs = function(callback, data) local cjson = require('cjson') ngx.say(callback .. '(' .. cjson.
请看示例代码(注意 data 的数组下标): -- http://www.kyne.com.au/~mark/software/lua-cjson.php-- version: 2.1 devellocal json = require("cjson")local data = {1, 2}data[1000] = 99-- ... do the other thingsngx.say(json.encode(data))运行日志报错结果: 2015/06/27 00:23:13 [error] 2714#0: *40 lua entry thread aborted: runtime error: ...