[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: lua_next() and tables - question
- From: "Kevin Baca" <lualist@...>
- Date: Mon, 13 Dec 2004 11:40:35 -0800
> lua_getglobal(L, "testArray");
> if(!lua_istable(L,-1))
> {
> cout<<"\nError getting table\n";
> lua_close(L);
> exit(0);
> }
> tIndex=lua_gettop(L);
> lua_gettable(L,-1);
remove the above line of code.
> lua_pushnil(L); // first key
> while (lua_next(L, tIndex) != 0)
> {
> cout<<"\n";
> cout<<"key has type="<<lua_typename(L, lua_type(L, -2));
> cout<<", value has type:"<<lua_typename(L, lua_type(L, -1));
> lua_pop(L, 1);
> }
> lua_close(L);
> system("PAUSE");
> return 0;
> }
-Kevin