Interface LuaTableTrait

All Superinterfaces:
Map<LuaValue,LuaValue>
All Known Subinterfaces:
LuaValue
All Known Implementing Classes:
AbstractLuaValue, AbstractRefLuaValue, ImmutableLuaValue, LuaTableValue, RefLuaValue

public interface LuaTableTrait extends Map<LuaValue,LuaValue>
  • Method Details

    • length

      int length()
      Returns the length of the array part of this Lua table.
      Returns:
      the length as would be returned by the Lua # operator
    • size

      int size()
      Returns the size of this Lua table.

      Please note that Lua does not offer a method to get the size of a table, so this function will need to iterate over it to calculate the size.

      Specified by:
      size in interface Map<LuaValue,LuaValue>
      Returns:
      the size
    • get

      LuaValue get(int i)
      Gets the value at the specified integer index from the table.
      Parameters:
      i - the index
      Returns:
      thisLuaValue[i]
    • get

      LuaValue get(Object key)
      Specified by:
      get in interface Map<LuaValue,LuaValue>
      Parameters:
      key - the key, either a LuaValue type or any Java object
      Returns:
      thisLuaValue[key]
    • get

      LuaValue get(String key)
      Gets the value at the specified string key from the table.
      Parameters:
      key - the key
      Returns:
      thisLuaValue[key]
    • get

      LuaValue get(LuaValue key)
      Gets the value at the specified Lua value key from the table.
      Parameters:
      key - the key
      Returns:
      thisLuaValue[key]
    • set

      LuaValue set(int key, Object value)
      Parameters:
      key - the key
      value - the value, either a LuaValue type or any Java object
      Returns:
      the previous value
    • set

      LuaValue set(Object key, Object value)
      Similar to put(LuaValue, LuaValue), but handles other Java types as well
      Parameters:
      key - the key, either a LuaValue type or any Java object
      value - the value, either a LuaValue type or any Java object
      Returns:
      the previous value
    • put

      LuaValue put(LuaValue key, LuaValue value)
      Performs thisLuaValue[key] = value
      Specified by:
      put in interface Map<LuaValue,LuaValue>
      Parameters:
      key - the key
      value - the value
      Returns:
      the old value