Squashed 'src/deps/src/lua-cjson/' changes from f95cd9ea1e..91ca29db9a

91ca29db9a doc: added doc for encode_skip_unsupported_value_types.
b0b4c58df8 doc: add comment for dtoa.c.
42ee52e79e doc: update location of cjson documentation.
REVERT: f95cd9ea1e doc: add comment for dtoa.c.

git-subtree-dir: src/deps/src/lua-cjson
git-subtree-split: 91ca29db9a4a4fd0eedaebcd5d5f3ba2ace5ae63
This commit is contained in:
Théophile Diot 2024-08-08 18:57:48 +01:00
parent cdc12b239d
commit 95cfced58d

View file

@ -15,6 +15,7 @@ Table of Contents
* [empty_array_mt](#empty_array_mt)
* [encode_number_precision](#encode_number_precision)
* [encode_escape_forward_slash](#encode_escape_forward_slash)
* [encode_skip_unsupported_value_types](#encode_skip_unsupported_value_types)
* [decode_array_with_array_mt](#decode_array_with_array_mt)
Description
@ -24,7 +25,7 @@ This fork of [mpx/lua-cjson](https://github.com/mpx/lua-cjson) is included in
the [OpenResty](https://openresty.org/) bundle and includes a few bugfixes and
improvements, especially to facilitate the encoding of empty tables as JSON Arrays.
Please refer to the [lua-cjson documentation](http://www.kyne.com.au/~mark/software/lua-cjson.php)
Please refer to the [lua-cjson documentation](https://kyne.au/~mark/software/lua-cjson.php)
for standard usage, this README only provides informations regarding this fork's additions.
See [`mpx/master..openresty/master`](https://github.com/mpx/lua-cjson/compare/master...openresty:master)
@ -171,6 +172,35 @@ If disabled, forward slash '/' will be encoded as '/' (no escape is applied).
[Back to TOC](#table-of-contents)
encode_skip_unsupported_value_types
---------------------------
**syntax:** `cjson.encode_skip_unsupported_value_types(enabled)`
**default:** false
If enabled, cjson will not throw exception when there are unsupported types
in the Lua table.
For example:
```lua
local ffi = require "ffi"
local cjson = require "cjson"
cjson.encode_skip_unsupported_value_types(true)
local t = {key = "val"}
t.cdata = ffi.new("char[?]", 100)
print(cjson.encode(t))
```
This will generate:
```json
{"key":"val"}
```
[Back to TOC](#table-of-contents)
decode_array_with_array_mt
--------------------------
**syntax:** `cjson.decode_array_with_array_mt(enabled)`