GetRef

Function

Syntax

Reads the variable, field, array cell, list element or map entry that a handle points at.

GetRef(<handle>)

Parts

<handle>A handle made with @target, usually kept in an AS HANDLE variable.

Returns

The current value of the target. A record comes back as the record itself; assigning it to a variable copies it.

Good to know

  • On a released handle, the program stops with "BASIC reference handle has been released". On a HANDLE variable never assigned, or on a value that is not a handle, it stops with "BASIC value is not a reference handle". Test with IsRef() first.
  • A handle made with @m() or @l() follows the cursor: GetRef reads whatever entry or element is current at that moment, not the one current when the handle was made.
  • A handle to a map entry, @m("key"), survives DeleteMapElement(): GetRef creates the entry again with the default value.

Example

GLOBAL hp AS integer = 100GLOBAL link AS HANDLE = @hphp = 80Console(Str(GetRef(link)))   ' 80
In the manual : Functions