-
Notifications
You must be signed in to change notification settings - Fork 5
Add slencode and sldecode functions for lljson #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Add slencode and sldecode functions for lljson #40
Conversation
There was a problem hiding this 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
sldecodefunction to decode JSON strings while preserving Lua types (vector, quaternion, uuid, etc.) - Added
slencodefunction to encode Lua values as JSON with type preservation - Reformatted several union type arrays from multi-line to single-line format for consistency
data/syntax_def_default.json
Outdated
| "returnType": "string" | ||
| }, | ||
| { | ||
| "comment": "decode json string to lua value perserving types", |
Copilot
AI
Dec 6, 2025
There was a problem hiding this comment.
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".
| "comment": "decode json string to lua value perserving types", | |
| "comment": "decode json string to lua value preserving types", |
| "parameters": [ | ||
| { | ||
| "name": "value", | ||
| "type": { | ||
| "kind": "union", | ||
| "types": [ | ||
| "string", | ||
| "number", | ||
| "vector", | ||
| "uuid", | ||
| "quaternion", | ||
| "boolean", | ||
| { | ||
| "elementType": "", | ||
| "kind": "array" | ||
| }, | ||
| "nil" | ||
| ] | ||
| } | ||
| } | ||
| ], |
There was a problem hiding this comment.
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
|
Also, I have been adding new elements to the slua defs to both
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.
Resolves #39