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 TypeMethodDescriptionint
count()
Get the number of arguments passed to this function.drop
(int count) Drop a number of arguments.@Nullable Object
get
(int index) Get the argument at the specific index.Object[]
getAll()
Get an array containing all asObject
s.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, wait
Methods 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:IArguments
Get the number of arguments passed to this function.- Specified by:
count
in interfaceIArguments
- Returns:
- The number of passed arguments.
-
drop
Description copied from interface:IArguments
Drop 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:
drop
in interfaceIArguments
- Parameters:
count
- The number of arguments to drop.- Returns:
- The new
IArguments
instance.
-
get
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 interfaceIArguments
- Parameters:
index
- The argument number.- Returns:
- The argument's value, or
null
if not present.
- Lua values of type "string" will be represented by a
-
getType
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 interfaceIArguments
- Parameters:
index
- The argument number.- Returns:
- The name of this type.
- See Also:
-
getAll
Description copied from interface:IArguments
Get an array containing all asObject
s.- Specified by:
getAll
in interfaceIArguments
- Returns:
- All arguments.
- See Also:
-