OperatorSpec¶
Type
OperatorSpec is passed to plugin:Operator to configure an operator.
Id¶
Id is the operator identifier, such as "build.hollow", exposed as the Studio command plugin.build.hollow.
Label¶
Label is the button text.
Tooltip¶
Tooltip is the button hover text, or nil.
Icon¶
Icon is a button icon path inside the plugin folder, such as "icons/hollow.svg", or nil.
Params¶
Params lists up to 32 ParamSpec entries in order, or is nil.
Prefab¶
Prefab is a .ldv UI prefab path (relative to the plugin folder) opened before a button run, or nil to run at once. When a descendant's Name matches a visible parameter, Studio fills it from the last confirmed run or that parameter's Default; Studio runs on "OK" or Enter and closes on "Cancel" or Escape.
Poll¶
Poll is called as Poll(ctx) to test whether the operator can run, or is nil when it always can. Return true to enable the button, or false and an optional tooltip reason to disable it.
Prepare¶
Prepare: ((ctx: PluginContext, params: {[string]: any}) -> (({[string]: any} | boolean)?, ...string?))?
Prepare is called as Prepare(ctx, params) before Execute, or is nil to run Execute at once. Return a table whose Avatar field is a string with a Luduvo username or user ID to have Studio look up that user's avatar before it calls Execute; when the lookup fails, the run fails with the lookup's error. A number in Avatar skips the lookup and Execute gets data as nil. Return false and an optional message (or raise an error) to cancel the run.
Execute¶
Execute(ctx: PluginContext, params: {[string]: any}, data: {[string]: any}?) -> (boolean, ...string?)
Execute is called as Execute(ctx, params, data) to apply edits through ctx.Edit. data is nil unless Prepare asked for an avatar; then data.Avatar has that user's UserId, Username, DisplayName, Body, BodyColors, Face, Shirt, Pants and Accessories (each with Asset, Slot, Sha256, Ready and, on failure, Error). Return true and an optional Output message to keep the edits, or return false (or raise an error) to undo every edit of the run.