Documentation

Added in v3.23

ref

Syntax: %ref(var)

Return a direct reference to an existing variable. Changing one variable will change any other variables that have a reference to the same variable.

Using this function prevents a copy of a variable from being made. When using large arrays or tables, this can be important to help improve performance.

Example

a = 123
b = %ref(a)
b = 999
#SHOW @a

Displays: 999. Since @b points to a direct reference of @a, changing the @b variable also causes the @a value to change. Using the #VAR command you can see the reference relationships.

Add comment

Login or register to post comments