- [[.:prplreference| PRPL reference]] <- [[.:prplreference#vars_and_functions|Vars and Functions]]
===== -?!* (Ref Exists Global) =====
^Arguments^Result^Notation^
| 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));