li.cil.oc.api.network
public interface Arguments extends java.lang.Iterable<java.lang.Object>
Callback.
It allows checking for the presence of arguments in a uniform manner, taking
care of proper type checking based on what can be passed along by Lua.
Note that integer values fetched this way are actually double values that
have been truncated. So if a Lua program passes 1.9 and you do a
checkInteger you'll get a 1.
The indexes passed to the various functions start at zero, i.e. to get the
first argument you would use checkAny(0). This is worth mentioning
because Lua starts its indexes at one.| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
checkAny(int index)
Get whatever is at the specified index.
|
boolean |
checkBoolean(int index)
Try to get a boolean value at the specified index.
|
byte[] |
checkByteArray(int index)
Try to get a byte array at the specified index.
|
double |
checkDouble(int index)
Try to get a double value at the specified index.
|
int |
checkInteger(int index)
Try to get an integer value at the specified index.
|
java.lang.String |
checkString(int index)
Try to get a string value at the specified index.
|
java.util.Map |
checkTable(int index)
Try to get a table at the specified index.
|
int |
count()
The total number of arguments that were passed to the function.
|
boolean |
isBoolean(int index)
Tests whether the argument at the specified index is a boolean value.
|
boolean |
isByteArray(int index)
Tests whether the argument at the specified index is a byte array.
|
boolean |
isDouble(int index)
Tests whether the argument at the specified index is a double value.
|
boolean |
isInteger(int index)
Tests whether the argument at the specified index is an integer value.
|
boolean |
isString(int index)
Tests whether the argument at the specified index is a string value.
|
boolean |
isTable(int index)
Tests whether the argument at the specified index is a table.
|
int count()
java.lang.Object checkAny(int index)
index - the index from which to get the argument.java.lang.IllegalArgumentException - if there is no argument at that index.boolean checkBoolean(int index)
index - the index from which to get the argument.java.lang.IllegalArgumentException - if there is no argument at that index,
or if the argument is not a boolean.int checkInteger(int index)
index - the index from which to get the argument.java.lang.IllegalArgumentException - if there is no argument at that index,
or if the argument is not a number.double checkDouble(int index)
index - the index from which to get the argument.java.lang.IllegalArgumentException - if there is no argument at that index,
or if the argument is not a number.java.lang.String checkString(int index)
index - the index from which to get the argument.java.lang.IllegalArgumentException - if there is no argument at that index,
or if the argument is not a string.byte[] checkByteArray(int index)
index - the index from which to get the argument.java.lang.IllegalArgumentException - if there is no argument at that index,
or if the argument is not a byte array.java.util.Map checkTable(int index)
index - the index from which to get the argument.java.lang.IllegalArgumentException - if there is no argument at that index,
or if the argument is not a table.boolean isBoolean(int index)
index - the index to check.boolean isInteger(int index)
index - the index to check.boolean isDouble(int index)
index - the index to check.boolean isString(int index)
index - the index to check.boolean isByteArray(int index)
index - the index to check.boolean isTable(int index)
index - the index to check.