Skip to content

Add support for LUA scripts - #3

Merged
mercurylinden merged 3 commits into
masterfrom
mercury/lua_support
Aug 5, 2026
Merged

Add support for LUA scripts#3
mercurylinden merged 3 commits into
masterfrom
mercury/lua_support

Conversation

@mercurylinden

Copy link
Copy Markdown

This pull request introduces support for creating and managing scripts with multiple runtimes (such as "lsl2", "mono", and "luau") in task inventory, along with improved error handling for capability POST requests. The main changes add a new capability for creating task inventory scripts, extend inventory item metadata to include script runtime, and refactor script upload/update methods to use explicit script runtime targets.

Script runtime and inventory enhancements:

  • Added a new RequestCreateTaskScriptAsync method in InventoryManager.Async.cs to create scripts in an object's inventory, supporting multiple runtimes and script languages. This includes the new CreateTaskInventoryItemMessage message class and associated enums for script language and target. [1] [2] [3]
  • Extended the InventoryItem class to include a Runtime property, which is populated from inventory metadata (if present) when deserializing from OSD. [1] [2] [3]

Capability and API changes:

  • Registered the new "CreateTaskInventoryItem" capability in Caps.cs.
  • Updated script upload methods (RequestUpdateScriptAgentInventoryAsync, RequestUpdateScriptTaskAsync) to use the new ScriptTarget enum instead of a boolean, allowing explicit selection of script runtime. This also affects usage in the UploadScriptCommand. [1] [2] [3]

Error handling improvements:

  • Enhanced capability POST handling to throw an exception if the HTTP response is not 200 OK, improving error reporting for failed capability requests.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds multi-runtime script creation/upload support (including Lua/Luau) to inventory/task inventory flows, and tightens capability POST error handling so failures surface as exceptions instead of being parsed as normal LLSD responses.

Changes:

  • Added CreateTaskInventoryItem capability support and a CreateTaskInventoryItemMessage for creating task-inventory scripts with selectable runtimes/languages.
  • Extended InventoryItem metadata parsing to capture script VM runtime (runtime) when present in task inventory responses.
  • Refactored script update APIs to use a ScriptTarget enum (instead of a mono boolean) and improved capability POST error handling.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
Programs/examples/TestClient/Commands/Inventory/UploadScriptCommand.cs Updates example client script upload call to use ScriptTarget.Mono.
LibreMetaverse/Messages/LindenMessages.cs Adds CreateTaskInventoryItemMessage for capability POST payloads.
LibreMetaverse/Inventory/InventoryManager.Handlers.cs Adds HTTP status checking to capability POST helper.
LibreMetaverse/Inventory/InventoryManager.Async.cs Introduces task script creation API and ScriptTarget / ScriptLanguage enums; updates script upload APIs.
LibreMetaverse/Inventory/InventoryBase.cs Adds Runtime property and populates it from task inventory metadata when available.
LibreMetaverse/Caps.cs Registers the new CreateTaskInventoryItem capability name.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +47 to +50
if (result.response.StatusCode != System.Net.HttpStatusCode.OK)
{
throw new System.Net.Http.HttpRequestException($"{result.response.StatusCode}({(int)result.response.StatusCode}): {System.Text.Encoding.UTF8.GetString(responseData)}");
}
Comment on lines 364 to +365
public async Task<(bool uploadSuccess, string uploadStatus, bool compileSuccess, List<string>? compileMessages, UUID itemID, UUID assetID)> RequestUpdateScriptAgentInventoryAsync(
byte[] data, UUID itemID, bool mono, CancellationToken cancellationToken = default, IProgress<ProgressReport>? progress = null)
byte[] data, UUID itemID, ScriptTarget target = ScriptTarget.Mono, CancellationToken cancellationToken = default, IProgress<ProgressReport>? progress = null)
Comment thread LibreMetaverse/Inventory/InventoryManager.Async.cs Outdated
Comment thread LibreMetaverse/Inventory/InventoryManager.Async.cs
Comment thread LibreMetaverse/Messages/LindenMessages.cs Outdated
Comment thread LibreMetaverse/Messages/LindenMessages.cs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@mercurylinden
mercurylinden merged commit ca59a1c into master Aug 5, 2026
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.

2 participants