Re: Table + LuaJava
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Table + LuaJava
- From: Anselmo Junior <afajunior@...>
- Date: Tue, 9 Jun 2009 07:55:12 -0300
Jerome, thanks for reply, i really inderstand.
In java i use this code and its work :D
public void test() {
state.getGlobal("init");
state.call(0, 1);
LuaObject table = state.getLuaObject(1);
System.out.println(table);
try {
LuaObject lo = state.getLuaObject(table, 3);
System.out.println(lo);
} catch (LuaException e) {
e.printStackTrace();
}
}
I think i'd be manipulate the LuaObject table methods, but its not... I have to use methos in LuaState ('state' its your instance).
I only need to know is how to get which keys that be used in the script.
2009年6月9日 Jerome Vuarand
<jerome.vuarand@gmail.com>
2009年6月9日 Anselmo Junior <afajunior@gmail.com>:
>> Here you are trying to get a string key "03" from a table that only has
>> numeric keys. I don't know what Java API you are using to access Lua, but
>> there should be a way to get numeric keys from the table.
>
> In LuaJava, the LuaState object has the same methods that is in C. If you
> know how to do is in C, i think we can do it with LuaState in java.
> I try replace in lua script the line "t[03] = "3"" for "t["03"] = "3"" and
> really work, i get the number "3" (the value of key "03"), but i'd like to
> use numeric keys.
The problems seems to be in LuaJava. The getField method of the
LuaObject class should take a LuaObject as parameter, not a String.
AFAICT you cannot use numeric keys with LuaJava.