I have a named function named “send” which in lua accepts a table array of integers for an argument.
On the java side, how do I fetch that data from the LuaState and convert it to an int[]?
private class send implements NamedJavaFunction {
@Override
public String getName() {
return “send”;
}
@Override
public int invoke(LuaState L) {
// get array size from LuaState
int[] nums = new int[arraySize];
// get array values from LuaState
This is my current approach which doesn’t seem to work:
int count = L.tableSize(1);
L.getTable(1);
int[] nums = new int[count];
for( int i = 0; i < count; i++ ) {
nums[i] = L.toInteger( i+1 );
}
Thanks