- [[.:prplreference| PRPL reference]] <- [[.:prplreference#vars_and_functions|Vars and Functions]]
===== <-!* (Ref Read Global) =====
^Arguments^Result^Notation^
| string | value | [ s1 - r1 ] |
=== Description ===
Read variable with string name s1 from the global heap. Reads the contents of the global variable and pushes it to the stack. This allows dynamic reading of variables. 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" <-!* trace
# Shows 42 in the debug window.
s1 = GetStringFromStack();
stack.Push(GameSpace.instance.globalHeap[s1]);
stack.Push(new Data(0));