lua-users home
lua-l archive

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

Katherine Scott wrote:
I am new to Lua/LuaPlus so this question may not be that difficult. I am trying to develop a scriptable GUI system using LuaPlus. My general plan of attack is to have a main "guiManager" that receives commands from lua via object dispatch functors. The guiManager's functors are being called, but it seems that I can't get the function arguments from the lua stack. Are there any differences for getting function arguments for functors versus directly registered functions?
Remember that the 'self' object comes in as the first parameter. Therefore, you have to access args[2] to get to the string.
int CLuaGooeyManager::createNewContext( LuaState * luaState )
    std::string name;
    LuaStack args(luaState); // grab the stack
    if( args[1].IsString() ) // !!! THIS TEST FAILS - THROWS ERROR
        name = args[1].GetString( ); // get the name

luaGooeyInterface = luaState.Get()->GetGlobals().CreateTable("MultiObjectMetaTable");
As an FYI, luaState.Get()-> is better put as luaState->

Your code is pretty much correct. Are you using the latest build of LuaPlus out of Subversion?