User Tools

Site Tools


prpl:refexistsglobal

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
prpl:refexistsglobal [2016/12/02 23:33] – external edit 127.0.0.1prpl:refexistsglobal [2025/02/14 14:57] (current) – external edit 127.0.0.1
Line 1: Line 1:
-<- [[.:prplreference| PRPL reference]] <- [[.:prplreference#everything_else_2|Everything Else 2]]+<- [[.:prplreference| PRPL reference]] <- [[.:prplreference#vars_and_functions|Vars and Functions]]
  
-=====  REFEXISTSGLOBAL  =====+=====  -?!* (Ref Exists Global)  =====
  
 ^Arguments^Result^Notation^ ^Arguments^Result^Notation^
-| | | [ - ] |+string True/False | [ s1 b1 ] |
  
  
 === Description === === 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 === === Examples ===
 +<code prpl>
 +# 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.
 +</code>
 <code> stack.Push(new Data(GameSpace.instance.globalHeap.ContainsKey(GetStringFromStack()) ? 1 : 0));  <code> stack.Push(new Data(GameSpace.instance.globalHeap.ContainsKey(GetStringFromStack()) ? 1 : 0)); 
    
 </code> </code>
  
prpl/refexistsglobal.1480721630.txt.gz · Last modified: 2025/02/14 14:56 (external edit)