Skip to main content

Globals

So far, we've used the terms “variable” and “global”. Here's a summary so that you can keep things clear:

Term Meaning Scope Example
Global A persistent array, on disk All ObjectScript processes that have access to the disk, and all routines in those processes, can access this variable. ^A
Process Private Global A persistent array, on disk Even though this is a global, only routines that run in your process can access this variable. It acts like a public variable that can grow in size beyond the limits of process memory. ^||A
Public variable A variable for your process All routines that run in your process, and any procedures that declare the variable public, can access this variable. A
Private variable A variable for your process Only the procedure where the variable is used can access this variable. A

It's very easy to learn about globals in ObjectScript. Everything you just learned about arrays applies to globals. You don't have to declare them. When you're ready to store something on disk, just use Set statements, and you'll build a tree like the one you saw in the animation. Space on disk is only used when it's needed. Kill removes nodes of a global, or an entire global (even with a million records!) immediately. Nearly all the functions and commands that you've learned about using regular variables work on globals in the exact same way. The only difference is the use of the “^” (caret) or “^||” character(s) before the global name.

FeedbackOpens in a new tab