Skip to content

Conversation

@mikelittman
Copy link

Resolves #39

Copilot AI review requested due to automatic review settings December 6, 2025 00:38
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds two new functions (slencode and sldecode) to the lljson module for type-preserving JSON encoding/decoding in Second Life's Lua scripting environment. The functions mirror the existing encode/decode functions but with explicit type preservation. The PR also includes formatting improvements, consolidating multi-line union type arrays into single-line format for better consistency across the file.

Key Changes

  • Added sldecode function to decode JSON strings while preserving Lua types (vector, quaternion, uuid, etc.)
  • Added slencode function to encode Lua values as JSON with type preservation
  • Reformatted several union type arrays from multi-line to single-line format for consistency

"returnType": "string"
},
{
"comment": "decode json string to lua value perserving types",
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in comment: "perserving" should be "preserving".

Suggested change
"comment": "decode json string to lua value perserving types",
"comment": "decode json string to lua value preserving types",

Copilot uses AI. Check for mistakes.
Comment on lines 15835 to 15855
"parameters": [
{
"name": "value",
"type": {
"kind": "union",
"types": [
"string",
"number",
"vector",
"uuid",
"quaternion",
"boolean",
{
"elementType": "",
"kind": "array"
},
"nil"
]
}
}
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing the second parameter

boolean tight, whether to encode sl types more compactly

@WolfGangS
Copy link
Contributor

WolfGangS commented Dec 6, 2025

Also, I have been adding new elements to the slua defs to both

  • data/dev/sl-lua-defs.json
    and
  • data/syntax_def_default.json

I believe only the latter is used by the plugin for definition generation

Add sldecode and slencode function signatures, including the 'tight'
boolean parameter for slencode, to the Lua API definitions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lljson missing slencode and sldecode

2 participants