lua-users home
lua-l archive

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


On 6/26/08, Cooper Clauson <ceclauson@hotmail.com> wrote:
> int luaConfigure(lua_State* L) {
>        std::cout << "Lua config function called!" << std::endl;
>
>        double d = (double)luaL_checknumber(L, 1);
>
>        luaL_checktype(L, 2, LUA_TTABLE);
>        lua_rawgeti(L, 2, 1);
>
>        const char* s = lua_tostring(L, -1);
>
>        std::cout << d << std::endl << s << std::endl;
>
>        //to restore the stack to its original state,
>        //but I get the same results even if I don't
>        //do this.
>        lua_pop(L, 3);
> }

I think you need to return the number of results you are leaving on
the stack. So, try replacing your pop with a return 0. Not sure what
happens if you return nothing at all.

Robby