PropInteger

Family: Studio · 2 forms

What it does

Reads an integer property of the script, as set in the editor.

Syntax

1
PropInteger(property string) → integer
2
PropInteger(property string, default integer) → integer

Parameters

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

Every form returns

integer

The property as an integer, with any fraction dropped. 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(PropInteger("value"))  Sync()LOOP

Form 2, with every argument

DO  Print(PropInteger("value", 1))  Sync()LOOP

PropInteger 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