Engine.script¶
The game's scripting language, HaloScript.
Functions¶
Engine.script.execute¶
Engine.script.execute(script)
Runs a HaloScript expression. Only script functions and globals can be used; console commands
added by Balltze or plugins cannot be run this way (use
Balltze.executeCommand).
Engine.script.execute("game_speed 0.5")
Engine.script.getGlobal¶
local value = Engine.script.getGlobal(name)
Returns the value of a script global. Names are not case sensitive. The engine's own globals are searched before the scenario's, so a scenario global with the name of an engine global cannot be reached.
Only boolean, real, short and long globals are supported. A global of another type, or a name
that does not exist, raises an error. Use pcall to check whether a global exists.
Engine.script.setGlobal¶
Engine.script.setGlobal(name, value)
Sets the value of a script global. Booleans accept any value. Short and long globals need a
whole number: 2 or 2.0 work, 1.7 raises an error. Real globals take any number. The same
types as getGlobal are supported.
Writing an engine global, such as a rasterizer_ setting, takes effect in the engine.
-- "lua_short" is a short global declared by the map's scripts.
local count = Engine.script.getGlobal("lua_short")
Engine.script.setGlobal("lua_short", count + 1)