User Tools

Site Tools


prpl:refexistsglobal

<- PRPL reference <- Vars and Functions

-?!* (Ref Exists Global)

ArgumentsResultNotation
string True/False [ s1 - b1 ]

Description

Check if variable with name s1 exists on the global heap (has been assigned). If so, 1 is pushed to the stack else 0. Global variables can be accessed by any script on the map.

Examples

# In one script:
42 ->*myGlobalVariable
# In any script on the same map after that point:
"myGlobalVariable" -?!* if
    "myGlobalVariable exists."
else
    "myGlobalVariable does not exist."
endif
trace
# Puts "myGlobalVariable exists." in the debug window.
	stack.Push(new Data(GameSpace.instance.globalHeap.ContainsKey(GetStringFromStack()) ? 1 : 0)); 
 
prpl/refexistsglobal.txt · Last modified: 2017/10/24 18:19 by GameGibu