Class ScriptInLua
java.lang.Object
games.stendhal.server.core.scripting.ScriptingSandbox
games.stendhal.server.core.scripting.ScriptInLua
Manages scripts written in Lua.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ScriptInLua
get()
Singleton access method.static ScriptInLua
Deprecated.Use @ref ScriptInLua.get().void
init()
Loads lua master script.boolean
Initial load of the script.boolean
For manually loading an external Lua script.void
runAfter(int turns, org.luaj.vm2.LuaFunction func)
Executes a function after a specified number of turns.void
Sets the background music for the current zone.void
Sets the background music for the current zone.Methods inherited from class games.stendhal.server.core.scripting.ScriptingSandbox
add, add, add, add, addGameEvent, execute, getCreature, getCreatures, getItem, getItems, getMessage, getZone, getZone, modify, playerIsInZone, postExecute, preExecute, privateText, remove, remove, setMessage, setZone, setZone, unload
-
Method Details
-
get
Singleton access method.- Returns:
- The static instance.
-
getInstance
Deprecated.Use @ref ScriptInLua.get(). -
load
Initial load of the script.- Specified by:
load
in classScriptingSandbox
- Parameters:
player
- The admin who loads script ornull
on server start.args
- The arguments the admin specified ornull
on server start.
-
load
For manually loading an external Lua script.- Parameters:
filename
- Relative path to script (usually in "data/script").player
- The admin who loads the script.args
- The arguments the admin specified.- Returns:
true
if loading succeeded.
-
init
public void init()Loads lua master script. -
setMusic
Sets the background music for the current zone.- Parameters:
filename
- File basename excluding .ogg extension.args
- Lua table of key=value integer values. Valid keys are `volume`, `x`, `y`, & `radius`.
-
setMusic
Sets the background music for the current zone.- Parameters:
filename
- File basename excluding .ogg extension.
-
runAfter
public void runAfter(int turns, org.luaj.vm2.LuaFunction func)Executes a function after a specified number of turns. FIXME: how to invoke with parameters- Parameters:
turns
- Number of turns to wait.func
- The function to be executed.
-