ReleaseRef

Function

Syntax

Ends a handle. The variable it pointed at is not touched; only the handle stops working.

ReleaseRef(<handle>)

Parts

<handle>A handle made with @target.

Returns

NULL.

Good to know

  • After it, IsRef() is false, and GetRef() or SetRef() stop the program with "BASIC reference handle has been released".
  • Every copy of the handle is ended too: copies share one state.
  • Releasing twice is allowed. Releasing a HANDLE variable that was never assigned, or a value that is not a handle, stops the program with "BASIC value is not a reference handle".

Example

hp AS integer = 100link AS HANDLE = @hpSetRef(link, 75)ReleaseRef(link)IF NOT IsRef(link) THEN Console("released")   ' releasedConsole(Str(hp))   ' 75
In the manual : Functions