Skip to main content

Properties

A property is the script's setting: it shows in the component's form in the editor, and every component gives it its own value.

/// Closing may pass midnight.
property closesAt: time = 03:00 "Closes"
property speed: float = 1.0 "Speed · Hz" range 0.1 to 5 step 0.1
property onColor: color = #ffd878 "Colour when on" was "color"

group "Opening hours"
property opensAt: time = 18:00 "Opens"
end

Form​

property name: type = default ["label"] [range a to b] [step s] [hidden] [was "oldName"]
  • The label is the name in the form; without one the property's name shows. The /// comment above it becomes its tooltip.
  • range a to b and step s bound a number field and set its step.
  • hidden keeps the property out of the form.
  • was "oldName" declares a rename: values components gave under the old name move to the new one. A rename is a data migration (Saving and migration), so renaming in the editor does not write was for you.
  • group "Name" … end gathers properties under a titled group in the form.

Types​

Properties take the types the editor can show: bool int float string time color. A duration property comes in the next version.

Where the value comes from​

A property's value is resolved in this order, each overriding the one before:

  1. the default in the script;
  2. the component's value in the package (values: only what differs from the default is written);
  3. the value of the placed instance in the scene (a placement's own values; coming to the editor).
  • The default is an expression of literals and operators only.
  • A property is read-only while the script runs and is not saved; for state that changes, use memory.