Class ObjectArguments

java.lang.Object
dan200.computercraft.api.lua.ObjectArguments
All Implemented Interfaces:
IArguments

public final class ObjectArguments extends Object implements IArguments
An implementation of IArguments which wraps an array of Object.
  • Constructor Details

    • ObjectArguments

      @Deprecated public ObjectArguments(IArguments arguments)
      Deprecated.
    • ObjectArguments

      public ObjectArguments(Object... args)
    • ObjectArguments

      public ObjectArguments(List<Object> args)
  • Method Details

    • count

      public int count()
      Description copied from interface: IArguments
      Get the number of arguments passed to this function.
      Specified by:
      count in interface IArguments
      Returns:
      The number of passed arguments.
    • drop

      public IArguments drop(int count)
      Description copied from interface: IArguments
      Drop a number of arguments. The returned arguments instance will access arguments at position i + count, rather than i. However, errors will still use the given argument index.
      Specified by:
      drop in interface IArguments
      Parameters:
      count - The number of arguments to drop.
      Returns:
      The new IArguments instance.
    • get

      public @Nullable Object get(int index)
      Description copied from interface: IArguments
      Get the argument at the specific index. The returned value must obey the following conversion rules:
      • Lua values of type "string" will be represented by a String.
      • Lua values of type "number" will be represented by a Number.
      • Lua values of type "boolean" will be represented by a Boolean.
      • Lua values of type "table" will be represented by a Map.
      • Lua values of any other type will be represented by a null value.
      Specified by:
      get in interface IArguments
      Parameters:
      index - The argument number.
      Returns:
      The argument's value, or null if not present.
    • getType

      public String getType(int index)
      Description copied from interface: IArguments
      Get the type name of the argument at the specific index.

      This method is meant to be used in error reporting (namely with LuaValues.badArgumentOf(IArguments, int, String)), and should not be used to determine the actual type of an argument.

      Specified by:
      getType in interface IArguments
      Parameters:
      index - The argument number.
      Returns:
      The name of this type.
      See Also:
    • getAll

      public Object[] getAll()
      Description copied from interface: IArguments
      Get an array containing all as Objects.
      Specified by:
      getAll in interface IArguments
      Returns:
      All arguments.
      See Also: