Interface LuaThread

All Known Subinterfaces:
Lua
All Known Implementing Classes:
AbstractLua, Lua51, Lua52, Lua53, Lua54, Lua55, LuaJ, LuaJit

public interface LuaThread
  • Method Details

    • set

      void set(String key, Object value)
      Sets a global variable to the given value
      Parameters:
      key - the global variable name
      value - the value
    • get

      LuaValue get(String globalName)
      Gets a references to a global object
      Parameters:
      globalName - the global name
      Returns:
      a reference to the value
    • register

      void register(String name, LuaFunction function)
      Registers the function to a global name
      Parameters:
      name - the global name
      function - the function
    • eval

      LuaValue[] eval(String command) throws LuaException
      Executes Lua code
      Parameters:
      command - the command
      Returns:
      the return values
      Throws:
      LuaException
    • require

      LuaValue require(String module) throws LuaException
      Loads a module, similar to the Lua `require` function

      Please note that this method will attempt to call Lua.openLibrary("package") first and cache the global require function.

      Parameters:
      module - the module name
      Returns:
      the module
      Throws:
      LuaException
    • fromNull

      LuaValue fromNull()
      Creates a nil Lua value.
      Returns:
      a nil Lua value
    • from

      LuaValue from(boolean b)
      Creates a boolean Lua value from a Java boolean.
      Parameters:
      b - the boolean
      Returns:
      a boolean Lua value
    • from

      LuaValue from(double n)
      Creates a number Lua value from a Java double.
      Parameters:
      n - the number
      Returns:
      a number Lua value
    • from

      LuaValue from(long n)
      Creates a number Lua value from a Java long.
      Parameters:
      n - the number
      Returns:
      a number Lua value
    • from

      LuaValue from(String s)
      Creates a string Lua value from a Java string.
      Parameters:
      s - the string
      Returns:
      a string Lua value
    • from

      LuaValue from(ByteBuffer buffer)
      Creates a raw string Lua value from a byte buffer.
      Parameters:
      buffer - the content of the raw string
      Returns:
      a raw string Lua value