diff options
author | Thibault Charbonnier <thibaultcha@me.com> | 2016-02-28 20:03:12 -0800 |
---|---|---|
committer | Thibault Charbonnier <thibaultcha@me.com> | 2016-03-03 10:54:53 -0800 |
commit | 7a9c25ee69f38974e99322971eace37ba1753074 (patch) | |
tree | 8aded977eea3eca5f7c6ff2934615a602dacbc8f /lua | |
parent | 77b8669c95500629dff6e34b4b6b0df5d0041ddf (diff) | |
download | lua-cjson-7a9c25ee69f38974e99322971eace37ba1753074.tar.gz lua-cjson-7a9c25ee69f38974e99322971eace37ba1753074.tar.bz2 lua-cjson-7a9c25ee69f38974e99322971eace37ba1753074.zip |
feat: cjson.as_array metamethod to enforce empty array encoding
A proposed improved patch of openresty/lua-cjson#1 (a patch commonly
proposed to lua-cjson and its forks), taking into considerations
comments from the original PR.
- use a lightuserdata key to store the metatable in the Lua Registry
(more efficient and avoiding conflicts)
- provide a lightuserdata resulting in empty arrays as well
- tests cases moved to t/agentzh.t, where cases for
'encode_empty_table_as_object' are already written. It seems like a
better place for tests specific to the OpenResty fork's additions.
- a more complex test case
Diffstat (limited to 'lua')
0 files changed, 0 insertions, 0 deletions