From 9fbacd01e247c8ed44f564d289fe5fe0e25a30c3 Mon Sep 17 00:00:00 2001 From: tapple Date: Thu, 12 Mar 2026 08:37:16 -0700 Subject: [PATCH 1/4] Deprecate the LSL JSON functions --- generated/slua_default.d.luau | 10 +++++----- generated/slua_keywords_pretty.xml | 30 ++++++++++++++++++++++++++++ generated/slua_selene.yml | 10 ++++++++++ lsl_definitions.yaml | 32 ++++++++++++++++++++++++++++++ lsl_definitions/lsl.py | 4 +++- 5 files changed, 80 insertions(+), 6 deletions(-) diff --git a/generated/slua_default.d.luau b/generated/slua_default.d.luau index 266e83a..6d2667b 100644 --- a/generated/slua_default.d.luau +++ b/generated/slua_default.d.luau @@ -696,10 +696,10 @@ declare ll: { IntegerToBase64: (Value: number) -> string, IsFriend: (agent_id: uuid) -> boolean, IsLinkGLTFMaterial: (link: number, face: number) -> boolean, - Json2List: (JSON: string) -> {any}, - JsonGetValue: (JSON: string, Specifiers: list) -> string, - JsonSetValue: (JSON: string, Specifiers: list, Value: string) -> string, - JsonValueType: (JSON: string, Specifiers: list) -> string, + Json2List: @[deprecated {use='lljson.decode'}](JSON: string) -> {any}, + JsonGetValue: @[deprecated {use='lljson.decode', reason='Also, the indices are zero-based.'}](JSON: string, Specifiers: list) -> string, + JsonSetValue: @[deprecated {use='lljson.encode', reason='Also, the indices are zero-based.'}](JSON: string, Specifiers: list, Value: string) -> string, + JsonValueType: @[deprecated {reason='Use lljson.decode and typeof instead.'}](JSON: string, Specifiers: list) -> string, Key2Name: (ID: uuid) -> string, KeyCountKeyValue: () -> uuid, KeysKeyValue: (First: number, Count: number) -> uuid, @@ -727,7 +727,7 @@ declare ll: { List2CSV: (ListVariable: list) -> string, List2Float: (ListVariable: list, Index: number) -> number, List2Integer: (ListVariable: list, Index: number) -> number, - List2Json: (JsonType: string, Values: list) -> string, + List2Json: @[deprecated {use='lljson.encode'}](JsonType: string, Values: list) -> string, List2Key: (ListVariable: list, Index: number) -> uuid, List2List: (ListVariable: {T}, Start: number, End: number) -> {T}, List2ListSlice: (ListVariable: {T}, Start: number, End: number, Stride: number, slice_index: number) -> {T}, diff --git a/generated/slua_keywords_pretty.xml b/generated/slua_keywords_pretty.xml index c8df3b2..cc864b5 100644 --- a/generated/slua_keywords_pretty.xml +++ b/generated/slua_keywords_pretty.xml @@ -2991,6 +2991,8 @@ export type rotation = quaternion JSON_APPEND + deprecated + true tooltip type @@ -3000,6 +3002,8 @@ export type rotation = quaternion JSON_ARRAY + deprecated + true tooltip type @@ -3009,6 +3013,8 @@ export type rotation = quaternion JSON_DELETE + deprecated + true tooltip type @@ -3018,6 +3024,8 @@ export type rotation = quaternion JSON_FALSE + deprecated + true tooltip type @@ -3027,6 +3035,8 @@ export type rotation = quaternion JSON_INVALID + deprecated + true tooltip type @@ -3036,6 +3046,8 @@ export type rotation = quaternion JSON_NULL + deprecated + true tooltip type @@ -3045,6 +3057,8 @@ export type rotation = quaternion JSON_NUMBER + deprecated + true tooltip type @@ -3054,6 +3068,8 @@ export type rotation = quaternion JSON_OBJECT + deprecated + true tooltip type @@ -3063,6 +3079,8 @@ export type rotation = quaternion JSON_STRING + deprecated + true tooltip type @@ -3072,6 +3090,8 @@ export type rotation = quaternion JSON_TRUE + deprecated + true tooltip type @@ -22295,6 +22315,8 @@ Returns true if result is non-zero. + deprecated + true energy 10.0 return @@ -22327,6 +22349,8 @@ Returns true if result is non-zero. + deprecated + true energy 10.0 return @@ -22368,6 +22392,8 @@ Returns true if result is non-zero. + deprecated + true energy 10.0 return @@ -22400,6 +22426,8 @@ Returns true if result is non-zero. + deprecated + true energy 10.0 return @@ -23210,6 +23238,8 @@ Returns true if result is non-zero. + deprecated + true energy 10.0 return diff --git a/generated/slua_selene.yml b/generated/slua_selene.yml index 8bcc4a7..862894f 100644 --- a/generated/slua_selene.yml +++ b/generated/slua_selene.yml @@ -6865,17 +6865,23 @@ globals: must_use: true description: Checks the face for a PBR render material. ll.Json2List: + deprecated: + message: Use 'lljson.decode' instead. args: - type: string must_use: true description: Converts the top level of the JSON string to a list. ll.JsonGetValue: + deprecated: + message: Use 'lljson.decode' instead. Also, the indices are zero-based. args: - type: string - type: table must_use: true description: Gets the value indicated by Specifiers from the JSON string. ll.JsonSetValue: + deprecated: + message: Use 'lljson.encode' instead. Also, the indices are zero-based. args: - type: string - type: table @@ -6884,6 +6890,8 @@ globals: description: Returns a new JSON string that is the JSON given with the Value indicated by Specifiers set to Value. ll.JsonValueType: + deprecated: + message: Use lljson.decode and typeof instead. args: - type: string - type: table @@ -7075,6 +7083,8 @@ globals: in the specified list. If Index describes a location not in the list, or the value cannot be type-cast to an integer, then zero is returned. ll.List2Json: + deprecated: + message: Use 'lljson.encode' instead. args: - type: string - type: table diff --git a/lsl_definitions.yaml b/lsl_definitions.yaml index cce3548..bcbc510 100644 --- a/lsl_definitions.yaml +++ b/lsl_definitions.yaml @@ -1258,42 +1258,62 @@ constants: type: integer value: 0 JSON_APPEND: + slua-deprecated: + reason: Use lljson.decode and table.insert instead. tooltip: '' type: integer value: -1 JSON_ARRAY: + slua-deprecated: + use: lljson.array_mt tooltip: '' type: string value: '\u{FDD2}' JSON_DELETE: + slua-deprecated: + use: nil tooltip: '' type: string value: '\u{FDD8}' JSON_FALSE: + slua-deprecated: + use: "false" tooltip: '' type: string value: '\u{FDD7}' JSON_INVALID: + slua-deprecated: + use: pcall tooltip: '' type: string value: '\u{FDD0}' JSON_NULL: + slua-deprecated: + use: lljson.null tooltip: '' type: string value: '\u{FDD5}' JSON_NUMBER: + slua-deprecated: + use: typeof tooltip: '' type: string value: '\u{FDD3}' JSON_OBJECT: + slua-deprecated: + use: lljson.object_mt tooltip: '' type: string value: '\u{FDD1}' JSON_STRING: + slua-deprecated: + use: typeof tooltip: '' type: string value: '\u{FDD4}' JSON_TRUE: + slua-deprecated: + use: "true" tooltip: '' type: string value: '\u{FDD6}' @@ -8103,6 +8123,8 @@ functions: - JSON: tooltip: '' type: string + slua-deprecated: + use: lljson.decode energy: 10.0 func-id: 513 pure: true @@ -8120,6 +8142,9 @@ functions: # But we don't support that in the bindgen yet. # index-semantics: true type: list + slua-deprecated: + use: lljson.decode + reason: Also, the indices are zero-based. energy: 10.0 func-id: 511 pure: true @@ -8140,6 +8165,9 @@ functions: - Value: tooltip: '' type: string + slua-deprecated: + use: lljson.encode + reason: Also, the indices are zero-based. energy: 10.0 func-id: 510 pure: true @@ -8158,6 +8186,8 @@ functions: # But we don't support that in the bindgen yet. # index-semantics: true type: list + slua-deprecated: + reason: Use lljson.decode and typeof instead. energy: 10.0 func-id: 512 pure: true @@ -8572,6 +8602,8 @@ functions: - Values: tooltip: List of values to convert. type: list + slua-deprecated: + use: lljson.encode energy: 10.0 func-id: 514 pure: true diff --git a/lsl_definitions/lsl.py b/lsl_definitions/lsl.py index e040483..b25c79d 100644 --- a/lsl_definitions/lsl.py +++ b/lsl_definitions/lsl.py @@ -146,6 +146,7 @@ class LSLConstant(NamedTuple): """ tooltip: str deprecated: Deprecated | None + slua_deprecated: Deprecated | None private: bool """Whether this should this be included in the syntax file""" @@ -204,7 +205,7 @@ def to_slua_dict(self, slua: "SLuaDefinitions") -> dict: try: return remove_worthless( { - "deprecated": self.deprecated is not None, + "deprecated": (self.deprecated or self.slua_deprecated) is not None, # Will always use a node, but that's fine for our purposes. # That's already the case for vector and hex int constants, anyway. "tooltip": self.tooltip, @@ -648,6 +649,7 @@ def _handle_constant(self, const_name: str, const_data: dict) -> LSLConstant: tooltip=const_data.get("tooltip", ""), private=const_data.get("private", False), deprecated=Deprecated.from_definition(const_data.get("deprecated", False)), + slua_deprecated=Deprecated.from_definition(const_data.get("slua-deprecated", False)), ) if const.type not in {"float", "integer", "string", "vector", "rotation"}: raise ValueError(f"Invalid constant type {const.type}") From 70f21bf0b41c434cb8b090f45246013e2c6621f9 Mon Sep 17 00:00:00 2001 From: tapple Date: Thu, 12 Mar 2026 08:42:42 -0700 Subject: [PATCH 2/4] note that llJsonValueType uses 0-indexing --- lsl_definitions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lsl_definitions.yaml b/lsl_definitions.yaml index bcbc510..7a72382 100644 --- a/lsl_definitions.yaml +++ b/lsl_definitions.yaml @@ -8187,7 +8187,7 @@ functions: # index-semantics: true type: list slua-deprecated: - reason: Use lljson.decode and typeof instead. + reason: Use lljson.decode and typeof instead. Also, the indices are zero-based. energy: 10.0 func-id: 512 pure: true From 7603fb24551165b1a60c98b9416c75baebe8c738 Mon Sep 17 00:00:00 2001 From: tapple Date: Thu, 12 Mar 2026 08:43:15 -0700 Subject: [PATCH 3/4] note that llJsonValueType uses 0-indexing --- generated/slua_default.d.luau | 2 +- generated/slua_selene.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/generated/slua_default.d.luau b/generated/slua_default.d.luau index 6d2667b..6cc75d5 100644 --- a/generated/slua_default.d.luau +++ b/generated/slua_default.d.luau @@ -699,7 +699,7 @@ declare ll: { Json2List: @[deprecated {use='lljson.decode'}](JSON: string) -> {any}, JsonGetValue: @[deprecated {use='lljson.decode', reason='Also, the indices are zero-based.'}](JSON: string, Specifiers: list) -> string, JsonSetValue: @[deprecated {use='lljson.encode', reason='Also, the indices are zero-based.'}](JSON: string, Specifiers: list, Value: string) -> string, - JsonValueType: @[deprecated {reason='Use lljson.decode and typeof instead.'}](JSON: string, Specifiers: list) -> string, + JsonValueType: @[deprecated {reason='Use lljson.decode and typeof instead. Also, the indices are zero-based.'}](JSON: string, Specifiers: list) -> string, Key2Name: (ID: uuid) -> string, KeyCountKeyValue: () -> uuid, KeysKeyValue: (First: number, Count: number) -> uuid, diff --git a/generated/slua_selene.yml b/generated/slua_selene.yml index 862894f..d3778b5 100644 --- a/generated/slua_selene.yml +++ b/generated/slua_selene.yml @@ -6891,7 +6891,7 @@ globals: by Specifiers set to Value. ll.JsonValueType: deprecated: - message: Use lljson.decode and typeof instead. + message: Use lljson.decode and typeof instead. Also, the indices are zero-based. args: - type: string - type: table From f51169ffd6def56dfb29d8bc1f895d69fb84668d Mon Sep 17 00:00:00 2001 From: tapple Date: Thu, 12 Mar 2026 08:55:30 -0700 Subject: [PATCH 4/4] better punctiation --- generated/slua_default.d.luau | 2 +- generated/slua_selene.yml | 4 +++- lsl_definitions.yaml | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/generated/slua_default.d.luau b/generated/slua_default.d.luau index 6cc75d5..2f97e14 100644 --- a/generated/slua_default.d.luau +++ b/generated/slua_default.d.luau @@ -699,7 +699,7 @@ declare ll: { Json2List: @[deprecated {use='lljson.decode'}](JSON: string) -> {any}, JsonGetValue: @[deprecated {use='lljson.decode', reason='Also, the indices are zero-based.'}](JSON: string, Specifiers: list) -> string, JsonSetValue: @[deprecated {use='lljson.encode', reason='Also, the indices are zero-based.'}](JSON: string, Specifiers: list, Value: string) -> string, - JsonValueType: @[deprecated {reason='Use lljson.decode and typeof instead. Also, the indices are zero-based.'}](JSON: string, Specifiers: list) -> string, + JsonValueType: @[deprecated {reason="Use 'lljson.decode' and 'typeof' instead. Also, the indices are zero-based."}](JSON: string, Specifiers: list) -> string, Key2Name: (ID: uuid) -> string, KeyCountKeyValue: () -> uuid, KeysKeyValue: (First: number, Count: number) -> uuid, diff --git a/generated/slua_selene.yml b/generated/slua_selene.yml index d3778b5..ed196e3 100644 --- a/generated/slua_selene.yml +++ b/generated/slua_selene.yml @@ -6891,7 +6891,7 @@ globals: by Specifiers set to Value. ll.JsonValueType: deprecated: - message: Use lljson.decode and typeof instead. Also, the indices are zero-based. + message: Use 'lljson.decode' and 'typeof' instead. Also, the indices are zero-based. args: - type: string - type: table @@ -7085,6 +7085,8 @@ globals: ll.List2Json: deprecated: message: Use 'lljson.encode' instead. + replace: + - lljson.encode(%2) args: - type: string - type: table diff --git a/lsl_definitions.yaml b/lsl_definitions.yaml index 7a72382..3d08891 100644 --- a/lsl_definitions.yaml +++ b/lsl_definitions.yaml @@ -1259,7 +1259,7 @@ constants: value: 0 JSON_APPEND: slua-deprecated: - reason: Use lljson.decode and table.insert instead. + reason: Use 'lljson.decode' and 'table.insert' instead. tooltip: '' type: integer value: -1 @@ -8187,7 +8187,7 @@ functions: # index-semantics: true type: list slua-deprecated: - reason: Use lljson.decode and typeof instead. Also, the indices are zero-based. + reason: Use 'lljson.decode' and 'typeof' instead. Also, the indices are zero-based. energy: 10.0 func-id: 512 pure: true @@ -8604,6 +8604,7 @@ functions: type: list slua-deprecated: use: lljson.encode + selene-replace: ["lljson.encode(%2)"] energy: 10.0 func-id: 514 pure: true