diff --git a/generated/slua_default.d.luau b/generated/slua_default.d.luau index 266e83a..2f97e14 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. Also, the indices are zero-based."}](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..ed196e3 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. Also, the indices are zero-based. args: - type: string - type: table @@ -7075,6 +7083,10 @@ 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. + replace: + - lljson.encode(%2) args: - type: string - type: table diff --git a/lsl_definitions.yaml b/lsl_definitions.yaml index cce3548..3d08891 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. Also, the indices are zero-based. energy: 10.0 func-id: 512 pure: true @@ -8572,6 +8602,9 @@ functions: - Values: tooltip: List of values to convert. type: list + slua-deprecated: + use: lljson.encode + selene-replace: ["lljson.encode(%2)"] 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}")