lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Oh yeah, and I recently try to do that and work. Only need get what key in the script is in use to get the values.

2009/6/9 Robert G. Jakabosky <bobby@sharedrealm.com>
On Tuesday 09, Anselmo Junior wrote:
> 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.

Looks like LuaJava's API doesn't follow the Lua C API completely.

Looking over the API docs for LuaJava I found this method in the LuaState
class:
getLuaObject(LuaObject parent, java.lang.String name)
getLuaObject(LuaObject parent, java.lang.Number name)
getLuaObject(LuaObject parent, LuaObject name)

based on the description it looks like you pass the table object as
the "parent" parameter and the "name" parameter is the key you want.

LuaState seems to be a weird place for that method.  I don't see why they
didn't put it in LuaObject.

--
Robert G. Jakabosky