1

So, I have a function in a Lua script that takes an parameter.

testFunction = function(listIn)
    for i, obj in ipairs(listIn) do
        print(i)
    end
end

This parameter is obviously meant to be a list of objects, but I simply cannot figure out how to pass this parameter in.

I use an interface for the script, so it would look something like this:

public interface LuaScript {
    void testFunction(List<?> listIn);
}

This is then called, and that part works fine, it's just that when it comes to the lua interpretation, it throws a LuaError, giving the message "bad argument: table expected, got userdata".

Any help is appreciated.

Wolfsurge
  • 27
  • 4

1 Answers1

1

Instead of a List<?>, pass it a LuaTable. LuaTable#listOf(LuaValue[]) will be helpful in converting the former to the latter.