Syntax
Tells whether a handle still points at something, so that GetRef() and SetRef() can be used on it safely.
IsRef(<handle>)Parts
| <handle> | Any value. Usually an AS HANDLE variable. |
|---|
Returns
TRUE when the handle is usable. FALSE after ReleaseRef(), after DELETE of the record that holds the target, for a HANDLE variable never assigned, and for any value that is not a handle. It never stops the program.
Good to know
- The result is
TRUEorFALSE, not 1 or 0.IF IsRef(h) = 1is always false. WriteIF IsRef(h),IF NOT IsRef(h)or= TRUE. Str(IsRef(h)) showstrueorfalse. - Copies of a handle share its state: after
h2 = handReleaseRef(h),IsRef(h2)is false too. - A handle to a map entry stays true after DeleteMapElement() removes that entry.
Example
hp AS integer = 100link AS HANDLEIF NOT IsRef(link) THEN Console("empty") ' emptylink = @hpIF IsRef(link) THEN Console("linked") ' linkedReleaseRef(link)IF NOT IsRef(link) THEN Console("released") ' releasedIn the manual : Functions