Package dan200.computercraft.api.lua
Class ObjectArguments
java.lang.Object
dan200.computercraft.api.lua.ObjectArguments
- All Implemented Interfaces:
IArguments
An implementation of
IArguments which wraps an array of Object.-
Constructor Summary
ConstructorsConstructorDescriptionObjectArguments(IArguments arguments) Deprecated.ObjectArguments(Object... args) ObjectArguments(List<Object> args) -
Method Summary
Modifier and TypeMethodDescriptionintcount()Get the number of arguments passed to this function.drop(int count) Drop a number of arguments.@Nullable Objectget(int index) Get the argument at the specific index.Object[]getAll()Get an array containing all asObjects.getType(int index) Get the type name of the argument at the specific index.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dan200.computercraft.api.lua.IArguments
escapes, getBoolean, getBytes, getBytesCoerced, getDouble, getEnum, getFiniteDouble, getInt, getLong, getString, getStringCoerced, getTable, getTableUnsafe, optBoolean, optBoolean, optBytes, optDouble, optDouble, optEnum, optFiniteDouble, optFiniteDouble, optInt, optInt, optLong, optLong, optString, optString, optTable, optTable, optTableUnsafe
-
Constructor Details
-
ObjectArguments
Deprecated. -
ObjectArguments
-
ObjectArguments
-
-
Method Details
-
count
public int count()Description copied from interface:IArgumentsGet the number of arguments passed to this function.- Specified by:
countin interfaceIArguments- Returns:
- The number of passed arguments.
-
drop
Description copied from interface:IArgumentsDrop a number of arguments. The returned arguments instance will access arguments at positioni + count, rather thani. However, errors will still use the given argument index.- Specified by:
dropin interfaceIArguments- Parameters:
count- The number of arguments to drop.- Returns:
- The new
IArgumentsinstance.
-
get
Description copied from interface:IArgumentsGet 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
nullvalue.
- Specified by:
getin interfaceIArguments- Parameters:
index- The argument number.- Returns:
- The argument's value, or
nullif not present.
- Lua values of type "string" will be represented by a
-
getType
Description copied from interface:IArgumentsGet 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:
getTypein interfaceIArguments- Parameters:
index- The argument number.- Returns:
- The name of this type.
- See Also:
-
getAll
Description copied from interface:IArgumentsGet an array containing all asObjects.- Specified by:
getAllin interfaceIArguments- Returns:
- All arguments.
- See Also:
-