I'm really stuck at this, searched my ass of google definitely, trying to "import" a table from lua to an array in java with luajava... Now, I've been able to do some easy stuff, printing lua-vars in java and reading a single element from a table.. everything working here
JAVA
LuaState L = LuaStateFactory.newLuaState();
L.openLibs();
L.LdoFile("data/test.lua");
L.getGlobal("x"); //I want to read lua-variable x
LuaObject obj = L.getLuaObject(L.getTop()); //So I get the top-element here
System.out.println(obj.getField("Version"));
LUA
x = { ["Version"] = 1.3,["Scans"] = 3 }
Now, this is obviously fairly easy for retrieving single values, but I'd like to get the whole object into Java (as an array or whatever) so I can do some stuff with it..
I tried looping through that LuaObject but since it's not iterable or a 'real' array yet, thats not possible..
Simply outputting obj
will tell me its a lua table, I've tried a lot of stupid stuff with .getObject, no success. Then I read something about proxies and .pcall (That looked like it was for passing values in Java to functions in lua, which is not, what i want)
Couldnt find anything in the (very very poorly) documented javadoc, so I'm hoping someone has experience with this.. Probably really easy one but hard to find information on.
Really happy about any information on this!
p.s. I CANNOT change the original lua file (later on) but that file will only contain one big table..