Class ScriptInLua

java.lang.Object
games.stendhal.server.core.scripting.ScriptingSandbox
games.stendhal.server.core.scripting.ScriptInLua

public class ScriptInLua extends ScriptingSandbox
Manages scripts written in Lua.
  • Method Details

    • get

      public static ScriptInLua get()
      Singleton access method.
      Returns:
      The static instance.
    • getInstance

      @Deprecated public static ScriptInLua getInstance()
      Deprecated.
      Use @ref ScriptInLua.get().
    • load

      public boolean load(Player player, List<String> args)
      Initial load of the script.
      Specified by:
      load in class ScriptingSandbox
      Parameters:
      player - The admin who loads script or null on server start.
      args - The arguments the admin specified or null on server start.
    • load

      public boolean load(String filename, Player player, List<String> args)
      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

      public void setMusic(String filename, org.luaj.vm2.LuaTable args)
      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

      public void setMusic(String filename)
      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.