diff --git a/generated/slua_default.d.luau b/generated/slua_default.d.luau
index a91c89d..cdaa28f 100644
--- a/generated/slua_default.d.luau
+++ b/generated/slua_default.d.luau
@@ -60,6 +60,22 @@ export type OsDateTime = {
yday: number?,
isdst: boolean?,
}
+type LLJsonEncodeOptions = {
+ tight: boolean?,
+ skip_tojson: boolean?,
+ allow_sparse: boolean?,
+ replacer: ((key: any, value: any, parent: {}?) -> any)?,
+}
+type LLJsonDecodeReviverWithoutPath = (key: string | number, value: any, parent: {}?, ctx: {}) -> any
+type LLJsonDecodeOptionsWithoutPath = {
+ track_path: false?,
+ reviver: LLJsonDecodeReviverWithoutPath?,
+} | LLJsonDecodeReviverWithoutPath
+type LLJsonDecodeOptionsWithPath = {
+ track_path: true,
+ reviver: (key: string | number, value: any, parent: {}?, ctx: {path: {string | number}}) -> any
+}
+type LLJsonDecodeOptions = LLJsonDecodeOptionsWithoutPath | LLJsonDecodeOptionsWithPath
declare extern type DetectedEvent with
index: number
@@ -256,15 +272,15 @@ declare llbase64: {
declare lljson: {
null: any,
- empty_array_mt: { [any]: any },
- array_mt: { [any]: any },
- empty_array: any,
- _NAME: string,
- _VERSION: string,
- encode: (value: any) -> string,
- decode: (json: string) -> any,
- slencode: (value: any, tight: boolean?) -> string,
- sldecode: (json: string) -> any,
+ remove: any,
+ array_mt: {__jsonhint: string},
+ object_mt: {__jsonhint: string},
+ empty_array: {},
+ empty_object: {},
+ encode: (value: any, options: LLJsonEncodeOptions?) -> string,
+ decode: (json: string, options: LLJsonDecodeOptions?) -> any,
+ slencode: (value: any, options: LLJsonEncodeOptions?) -> string,
+ sldecode: (json: string, options: LLJsonDecodeOptions?) -> any,
}
diff --git a/generated/slua_default.docs.json b/generated/slua_default.docs.json
index c3fcaf8..83e9552 100644
--- a/generated/slua_default.docs.json
+++ b/generated/slua_default.docs.json
@@ -256,27 +256,27 @@
"learn_more_link": "https://create.secondlife.com/script/learn-slua/json/"
},
"@sl-slua/global/lljson.null": {
- "documentation": "A constant to pass for null to json encode",
+ "documentation": "A constant to pass for null to json encode.",
"learn_more_link": "https://create.secondlife.com/script/learn-slua/json/"
},
- "@sl-slua/global/lljson.empty_array_mt": {
- "documentation": "Value: {}
Metatable for declaring table as an empty array for json encode",
+ "@sl-slua/global/lljson.remove": {
+ "documentation": "A constant to return from a reviver/replacer replacer function to omit this item.",
"learn_more_link": "https://create.secondlife.com/script/learn-slua/json/"
},
"@sl-slua/global/lljson.array_mt": {
- "documentation": "Value: {}
Metatable for declaring table as an array for json encode",
+ "documentation": "Value: {__jsonhint = \"array\"}
Metatable for declaring table as an array for json encode.",
"learn_more_link": "https://create.secondlife.com/script/learn-slua/json/"
},
- "@sl-slua/global/lljson.empty_array": {
- "documentation": "A constant to pass for an empty array to json encode",
+ "@sl-slua/global/lljson.object_mt": {
+ "documentation": "Value: {__jsonhint = \"object\"}
Metatable for declaring table as an object for json encode.",
"learn_more_link": "https://create.secondlife.com/script/learn-slua/json/"
},
- "@sl-slua/global/lljson._NAME": {
- "documentation": "Value: \"lljson\"
Name of the lljson library",
+ "@sl-slua/global/lljson.empty_array": {
+ "documentation": "Value: setmetatable({}, lljson.array_mt}
A constant to pass for an empty array to json encode.",
"learn_more_link": "https://create.secondlife.com/script/learn-slua/json/"
},
- "@sl-slua/global/lljson._VERSION": {
- "documentation": "Value: \"2.1.0.11\"
Version of the lljson library",
+ "@sl-slua/global/lljson.empty_object": {
+ "documentation": "Value: setmetatable({}, lljson.object_mt}
A constant to pass for an empty object to json encode.",
"learn_more_link": "https://create.secondlife.com/script/learn-slua/json/"
},
"@sl-slua/global/lljson.encode": {
diff --git a/generated/slua_keywords_pretty.xml b/generated/slua_keywords_pretty.xml
index db7f4a9..d239efb 100644
--- a/generated/slua_keywords_pretty.xml
+++ b/generated/slua_keywords_pretty.xml
@@ -235,53 +235,53 @@ export type rotation = quaternion
value
false
- lljson._NAME
+ lljson.array_mt
- lljson._VERSION
+ lljson.empty_array
- lljson.array_mt
+ lljson.empty_object
- lljson.empty_array
+ lljson.null
- lljson.empty_array_mt
+ lljson.object_mt
- lljson.null
+ lljson.remove
@@ -13104,6 +13104,15 @@ Returns true if result is non-zero.
string
+
energy
10.0
@@ -13127,6 +13136,15 @@ Returns true if result is non-zero.
any
+
+ options
+
+ tooltip
+
+ type
+ LLJsonEncodeOptions?
+
+
energy
10.0
@@ -13150,6 +13168,15 @@ Returns true if result is non-zero.
string
+
+ options
+
+ tooltip
+
+ type
+ LLJsonDecodeOptions?
+
+
energy
10.0
@@ -13174,12 +13201,12 @@ Returns true if result is non-zero.
- tight
+ options
tooltip
type
- boolean?
+ LLJsonEncodeOptions?
diff --git a/generated/slua_selene.yml b/generated/slua_selene.yml
index d74c6b7..f0fa36a 100644
--- a/generated/slua_selene.yml
+++ b/generated/slua_selene.yml
@@ -4339,42 +4339,47 @@ globals:
The output is truncated at the first decoding error.
lljson.null:
property: read-only
- description: A constant to pass for null to json encode
- lljson.empty_array_mt:
+ description: A constant to pass for null to json encode.
+ lljson.remove:
property: read-only
- type: table
- description: Metatable for declaring table as an empty array for json encode
+ description: A constant to return from a reviver/replacer replacer function to
+ omit this item.
lljson.array_mt:
property: read-only
type: table
- description: Metatable for declaring table as an array for json encode
- lljson.empty_array:
+ description: Metatable for declaring table as an array for json encode.
+ lljson.object_mt:
property: read-only
- description: A constant to pass for an empty array to json encode
- lljson._NAME:
+ type: table
+ description: Metatable for declaring table as an object for json encode.
+ lljson.empty_array:
property: read-only
- type: string
- description: Name of the lljson library
- lljson._VERSION:
+ type: table
+ description: A constant to pass for an empty array to json encode.
+ lljson.empty_object:
property: read-only
- type: string
- description: Version of the lljson library
+ type: table
+ description: A constant to pass for an empty object to json encode.
lljson.encode:
args:
- type: any
+ - type: table
+ required: false
must_use: true
description: Encodes a Lua value as JSON. Raises an error if value contains unsupported
types.
lljson.decode:
args:
- type: string
+ - type: any
+ required: false
must_use: true
description: Decodes a JSON string to a Lua value. Raises an error if JSON is
invalid.
lljson.slencode:
args:
- type: any
- - type: bool
+ - type: table
required: false
must_use: true
description: Encodes a Lua value as JSON, preserving SL types. Use tight to encode
@@ -4382,6 +4387,8 @@ globals:
lljson.sldecode:
args:
- type: string
+ - type: any
+ required: false
must_use: true
description: Decodes a JSON string to a Lua value, preserving SL types. Raises
an error if JSON is invalid.
diff --git a/slua_definitions.yaml b/slua_definitions.yaml
index df79a18..0b3c220 100644
--- a/slua_definitions.yaml
+++ b/slua_definitions.yaml
@@ -193,6 +193,37 @@ typeAliases:
isdst: boolean?,
}
selene-type: {display: "OsDateTime"}
+- name: LLJsonEncodeOptions
+ comment: Configuration options for lljson encoding
+ definition: |-
+ {
+ tight: boolean?,
+ skip_tojson: boolean?,
+ allow_sparse: boolean?,
+ replacer: ((key: any, value: any, parent: {}?) -> any)?,
+ }
+ selene-type: table
+- name: LLJsonDecodeReviverWithoutPath
+ definition: "(key: string | number, value: any, parent: {}?, ctx: {}) -> any"
+ selene-type: function
+- name: LLJsonDecodeOptionsWithoutPath
+ definition: |-
+ {
+ track_path: false?,
+ reviver: LLJsonDecodeReviverWithoutPath?,
+ } | LLJsonDecodeReviverWithoutPath
+ selene-type: any
+- name: LLJsonDecodeOptionsWithPath
+ definition: |-
+ {
+ track_path: true,
+ reviver: (key: string | number, value: any, parent: {}?, ctx: {path: {string | number}}) -> any
+ }
+ selene-type: table
+- name: LLJsonDecodeOptions
+ comment: Configuration options for lljson decoding
+ definition: "LLJsonDecodeOptionsWithoutPath | LLJsonDecodeOptionsWithPath"
+ selene-type: any
classes:
- name: LLEvents
comment: Event registration and management class for Second Life events
@@ -1088,6 +1119,8 @@ modules:
parameters:
- name: value
type: any
+ - name: options
+ type: LLJsonEncodeOptions?
returnType: string
must-use: true
- name: decode
@@ -1096,6 +1129,8 @@ modules:
parameters:
- name: json
type: string
+ - name: options
+ type: LLJsonDecodeOptions?
returnType: any
must-use: true
- name: slencode
@@ -1104,8 +1139,8 @@ modules:
parameters:
- name: value
type: any
- - name: tight
- type: boolean?
+ - name: options
+ type: LLJsonEncodeOptions?
returnType: string
must-use: true
- name: sldecode
@@ -1114,31 +1149,33 @@ modules:
parameters:
- name: json
type: string
+ - name: options
+ type: LLJsonDecodeOptions?
returnType: any
must-use: true
constants:
- name: 'null'
- comment: A constant to pass for null to json encode
+ comment: A constant to pass for null to json encode.
+ type: any
+ - name: remove
+ comment: A constant to return from a reviver/replacer replacer function to omit this item.
type: any
- - name: empty_array_mt
- comment: Metatable for declaring table as an empty array for json encode
- type: '{ [any]: any }'
- value: '{}'
- name: array_mt
- comment: Metatable for declaring table as an array for json encode
- type: '{ [any]: any }'
- value: '{}'
+ comment: Metatable for declaring table as an array for json encode.
+ type: '{__jsonhint: string}'
+ value: '{__jsonhint = "array"}'
+ - name: object_mt
+ comment: Metatable for declaring table as an object for json encode.
+ type: '{__jsonhint: string}'
+ value: '{__jsonhint = "object"}'
- name: empty_array
- comment: A constant to pass for an empty array to json encode
- type: any
- - name: _NAME
- comment: Name of the lljson library
- type: string
- value: '"lljson"'
- - name: _VERSION
- comment: Version of the lljson library
- type: string
- value: '"2.1.0.11"'
+ comment: A constant to pass for an empty array to json encode.
+ type: '{}'
+ value: 'setmetatable({}, lljson.array_mt}'
+ - name: empty_object
+ comment: A constant to pass for an empty object to json encode.
+ type: '{}'
+ value: 'setmetatable({}, lljson.object_mt}'
- name: math
comment: Mathematical functions library.
functions: