[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Table + LuaJava
- From: Anselmo Junior <afajunior@...>
- Date: Tue, 9 Jun 2009 00:56:02 -0300
Hello folks,
I'm new in Lua and i need some help with tables in lua and java interchange
In Lua script I made like that:
--init
function init()
local t = {}
t[03] = "3"
t[11] = "19"
t[12] = "25"
return trn
end
And java I made:
public void test() {
state.getGlobal("init");
state.call(0, 1);
LuaObject lo = state.getLuaObject(1);
state.pop(1);
try {
lo.getField("03");
System.out.println(lo.getField("03").getNumber());
} catch (LuaException e) {
e.printStackTrace();
}
}
"state" is a LuaState object that have been instanciate in Class Constructor.
"lo" returned a Lua Table, but if I pass getField("03") returned nil value
But i really need get not only the value of the table, but the keys too... because the keys will be random. Get the table's keys in java code it is possible?
I will appreciate if anyone could help me...