lua-users home
lua-l archive

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


lua_getglobal will return any lua_object

however to get foo.x from c I have to:

	lua_pushobject(lua_getglobal("foo")); 
	lua_pushstring("x");
	lua_gettable();

but if I wish to get the value foo.test.x I have to call gettable 
mutiple times or generally:
(stack contains all the elements of the name)

    lua_pushobject(lua_getglobal(stack[0]));
    lua_pushstring(stack[1]);
    int i=2;
    while (i<stack.GetSize())
    {
        lua_pushobject(lua_gettable());    
        lua_pushstring(stack[i++]);
    }

    lua_gettable();    


Is there an easier more general way of getting any lua value.  Could 
getglobal be 'upgraded' to handle these cases?

-cameron tofer