Script Markup

Additional information about variables in a script is communicated by adding markup comments. Markup comments begin with three dashes --- and can be placed on the same line as the variable:

local health = 100 --- number

Or on the preceding line:

--- number
local health = 100

A markup comment includes a sequence of annotations which may be specified in any order. The format of the annotations is described in the following sections.

Type annotation

Annotating a variable with a type will enable the variable to be modified in the editor with a user interface that's appropriate for that type. The supported types are:

The type names are not case sensitive.

Certain types also allow a range to be specified. The range is specified as a minimum and maximum value written after the type in the form (min, max).

Keep in mind that the range will not affect the value written to the variable from script; it will only affect the user interface presented for editing the variable.

Example:

--- number (0, 100)
local health = 100

Hidden annotation

Adding the hidden annotation to a variable will prevent it from being displayed in the editor.

Example:

 --- hidden number
local health = 100

Options annotation

A list of valid options can be specified for a field by specifying them as a comma separated list inside curly braces { }. While it's possible to set the value outside of this list from script, only these options will be available when manipulating the value in the editor, and the networking system may ignore values outside the list.

Only string and number types currently support option lists.

Example:

local skin  = "default" --- string { "default", "red", "green", "blue" }
local range = 10        --- number { 1, 10, 20, 100 }

Descriptor comments

Example:

--- The health of the player
--- number (0, 100)
local health = 100