void CCLuaStack::pushCCLuaValueDict(const CCLuaValueDict& dict)
{
    lua_newtable(m_state);                                              /* L: table */
    for (CCLuaValueDictIterator it = dict.begin(); it != dict.end(); ++it)
    {
        lua_pushstring(m_state, it->first.c_str());                     /* L: table key */
        pushCCLuaValue(it->second);                                     /* L: table key value */
        lua_rawset(m_state, -3);                     /* table.key = value, L: table */
    }
}
Exemple #2
0
int CCLuaEngine::pushCCLuaValueDict(const CCLuaValueDict& dict)
{
    lua_newtable(m_state);                                      /* stack: table */
    for (CCLuaValueDictIterator it = dict.begin(); it != dict.end(); ++it)
    {
        lua_pushstring(m_state, it->first.c_str());             /* stack: table key */
        pushCCLuaValue(it->second);                             /* stack: table key value */
        lua_rawset(m_state, -3);             /* table.key = value, stack: table */
    }
    
    return lua_gettop(m_state);
}