Prop

Family: Studio · 2 forms

What it does

Reads a numeric property of the script, as set in the editor.

Syntax

1
Prop(property string) → float
2
Prop(property string, default float) → float

Parameters

NameTypeIn formsMeaning
propertystringallThe property's name.
defaultfloat2The value returned when the property does not exist.

Every form returns

float

The property as a number: true and false become 1 and 0, text that is not a number gives 0. Returns 0, or default, when the property is missing.

Good to know

  • Without default, a missing property also writes one warning to the console, once per name.

Example · generated

Form 1, the short one

DO  Print(Prop("value"))  Sync()LOOP

Form 2, with every argument

DO  Print(Prop("value", 1.0))  Sync()LOOP

Prop is called and its answer is printed every frame. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.

Related commands

133 commands in Studio