senses:packages:kmj-json
kmj-json
The kmj-json package provides a JSON codec.
The runtime provides this library through the luaL_newlib auxiliary library function, so all fields can be assumed to be functions.
decode
The decode field contains a function for decoding a JSON encoded type.
Syntax
decode(input: string): (output: any)
Arguments
- The first argument should contain the JSON encoded representation of a type.
Returns
- The first return value will be the decoded Lua equivalent value type of the given JSON, or
nilif the input could not be interpreted successfully.
encode
The encode field contains a function for encoding a Lua value into a JSON encoded type.
Syntax
encode(input: any): (output: string|nil)
Arguments
- The first argument should contain the Lua value that should be JSON encoded. Accepted Lua types are nil, boolean, number, string and table.
Returns
- The first return value will be the JSON encoded representation of the given input, or a Lua
nilif an unsupported value such as function, userdata or thread was given.
senses/packages/kmj-json.txt · Last modified: by flash
