openresty/lua-cjson

attempt to call field 'decode_array_with_array_mt' (a nil value)?

wuyachao opened this issue · 6 comments

I look for all package.path.

/usr/local/lib/lua/5.1/cjson.so
/usr/local/Cellar/openresty/1.11.2.4/lualib/cjson.so

so mv /usr/local/lib/lua/5.1/cjson.so /usr/local/lib/lua/5.1/cjson.so.bak. then reload nginx.

when i use cjson.encode_empty_table_as_object(false) is ok. But the cjson.decode_array_with_array_mt(true) will cause error.

attempt to call field 'decode_array_with_array_mt' (a nil value)

env: mac
openresty: openresty/1.11.2.4

@wuyachao Seems like your openresty is just too old?

Try this:

brew untap homebrew/nginx   #  optional
brew tap openresty/brew
brew install openresty

The latest version is 1.13.6.1.

@agentzh I install the latest openresty/1.13.6.1. But it also cause this error.
Build the master branch cjson. It can work.

so I guess it not included in the latest version?

@wuyachao Oh, right, my bad. The latest features in lua-cjson is to be released in the next OpenResty version. The current latest OpenResty release does not have it yet. You need to use the git repo version of lua-cjson yourself.

Thanks for the software, it's great.

I'm running into this issue as well. When can we get a new version of OpenResty that includes this fix?

@manishahluwalia The latest lua-cjson will get included in the latest OpenResty release. It's been on our roadmap.