Menu
Lumberyard
Developer Guide (Version 1.11)

ScriptBind_Script

CryLua is deprecated and will be removed in a future version of Lumberyard.

Lists C++ script-related functions that you can call from Lua script.

DumpLoadedScripts

Dumps all loaded scripts.

Syntax

Copy
Script.DumpLoadedScripts()

KillTimer

Stops a timer set by the Script.SetTimer function.

Syntax

Copy
Script.KillTimer(ScriptHandle nTimerId)

Parameter Description
nTimerId The ID of the timer returned by the Script.SetTimer function.

LoadScript

Loads the specified script.

Syntax

Copy
Script.LoadScript(scriptName)

Parameter Description
scriptName The name of the script to load.

ReloadEntityScript

Reloads the specified entity script.

Syntax

Copy
Script.ReloadEntityScript(const char *className)

Parameter Description
className Name of the entity script.

ReloadScript

Reload the script.

Syntax

Copy
Script.ReloadScript(scriptName)

Parameter Description
scriptName The name of the script to reload.

ReloadScripts

Reloads all the scripts.

Syntax

Copy
Script.ReloadScripts()

SetTimer

Sets a script timer. When the timer expires, SetTimer calls the Lua function specified.

Syntax

Copy
Script.SetTimer(int nMilliseconds, HSCRIPTFUNCTION hFunc)

Returns the ID assigned to the timer or nil if no ID was specified.

Parameter Description
nMilliseconds Delay of the trigger in milliseconds.
luaFunction

The Lua function to call. If userData is specified, luaFunction must be in the format:

Copy
LuaCallback = function(userData,nTimerId) -- function body end;
.

If userData is not specified, luaFunction must be in the format:

Copy
LuaCallback = function(nTimerId) -- function body end;
userData Optional. Specifies a user defined table. If userData is specified, the table is passed as the first argument of the callback function.
bUpdateDuringPause Optional. The timer is updated and triggered even if the game is in pause mode.

SetTimerForFunction

Sets a timer for the specified function.

Syntax

Copy
Script.SetTimerForFunction(int nMilliseconds, const char *sFunctionName)

Returns the ID assigned to the timer, or nil if no ID was specified.

This function has the same parameters as the SetTimer function.

UnloadScript

Unloads the specified script.

Syntax

Copy
Script.UnloadScript(scriptName)

Parameter Description
scriptName The name of the script to unload.