void CCLuaStack::pushCCLuaValueArray(const CCLuaValueArray& array) { lua_newtable(m_state); /* L: table */ int index = 1; for (CCLuaValueArrayIterator it = array.begin(); it != array.end(); ++it) { pushCCLuaValue(*it); /* L: table value */ lua_rawseti(m_state, -2, index); /* table[index] = value, L: table */ ++index; } }
int CCLuaEngine::pushCCLuaValueArray(const CCLuaValueArray& array) { lua_newtable(m_state); /* stack: table */ int index = 1; for (CCLuaValueArrayIterator it = array.begin(); it != array.end(); ++it) { pushCCLuaValue(*it); /* stack: table value */ lua_rawseti(m_state, -2, index); /* table[index] = value, stack: table */ ++index; } return lua_gettop(m_state); }