Variables

  • There are 2 types of variables, Locals, and Globals. Locals are bound to their own scope (and childs), and are fast to use. Globals are stored in the YOUScript::Instance, and using them will be somewhat more expensive so try to make as much variables local as you can to keep speed!
local localvar = "local"
globalvar = "global"
  • Because globalvar does not have local infront of it, it will check if globalvar has been defined as a local before if not, this will redirect the call to the globals inside of the YOUScript::Instance
  • You can also use typesafe variables
local number somenumber = 15
  • Now the compiler knows it’s an number, and it can take that into account while optimizing