Description
Replaces the complete source code of a script (LuaSourceContainer) with new content.Endpoint
set_script_source
Parameters
The path to the script instance in the DataModel tree
The new source code to set for the script
Response
Success Response
Returns
true if the operation was successfulError Response
Error message if the operation failed. Possible errors:
- Path resolution failure
- “Not a script”
- Error from setting the Source property
Implementation Details
- Only works with instances that inherit from
LuaSourceContainer(Script, LocalScript, ModuleScript) - Completely replaces the existing source code
- Requires plugin permissions to write script sources
- Uses
pcallto safely set the Source property - Any existing content will be overwritten