Permalink
Browse files

Lua: remove the "n" entry in array-like tables; you have to use the #…

… operator instead
  • Loading branch information...
1 parent f0f587b commit 1874b58f97d7cfab84decdb4ff5f36a810fa9336 @hoijui hoijui committed Jun 21, 2011
View
@@ -640,7 +640,6 @@ bool CLuaUI::BuildCmdDescTable(lua_State* L,
}
lua_rawset(L, -3);
}
- HSTR_PUSH_NUMBER(L, "n", cmdDescCount);
return true;
}
View
@@ -229,7 +229,6 @@ static void PushUnitAndCommand(lua_State* L, const CUnit* unit, const Command& c
lua_pushnumber(L, cmd.params[p]);
lua_rawset(L, -3);
}
- HSTR_PUSH_NUMBER(L, "n", cmd.params.size());
// push the options table
lua_newtable(L);
@@ -4792,7 +4792,6 @@ int LuaSyncedRead::GetUnitPieceList(lua_State* L)
lua_pushsstring(L, lp.original->name);
lua_rawset(L, -3);
}
- HSTR_PUSH_NUMBER(L, "n", localModel->pieces.size());
return 1;
}
@@ -4810,7 +4809,6 @@ static int GetUnitPieceInfo(lua_State* L, const ModelType& op)
lua_pushsstring(L, op.childs[c]->name);
lua_rawset(L, -3);
}
- HSTR_PUSH_NUMBER(L, "n", op.childs.size());
lua_rawset(L, -3);
HSTR_PUSH(L, "isEmpty");
View
@@ -356,7 +356,6 @@ static int BuildOptions(lua_State* L, const void* data)
lua_rawset(L, -3);
}
}
- HSTR_PUSH_NUMBER(L, "n", count);
return 1;
}
@@ -424,7 +423,6 @@ static int WeaponsTable(lua_State* L, const void* data)
}
lua_rawset(L, -3);
}
- HSTR_PUSH_NUMBER(L, "n", weaponCount);
return 1;
}
@@ -447,7 +445,6 @@ static void PushGuiSoundSet(lua_State* L, const string& name,
}
lua_rawset(L, -3);
}
- HSTR_PUSH_NUMBER(L, "n", soundCount);
lua_rawset(L, -3);
}
@@ -975,7 +975,6 @@ int LuaUnsyncedRead::GetSelectedUnits(lua_State* L)
lua_pushnumber(L, (*it)->id);
lua_rawset(L, -3);
}
- HSTR_PUSH_NUMBER(L, "n", count);
return 1;
}
@@ -1006,11 +1005,9 @@ int LuaUnsyncedRead::GetSelectedUnitsSorted(lua_State* L)
lua_pushnumber(L, unit->id);
lua_rawset(L, -3);
}
- HSTR_PUSH_NUMBER(L, "n", v.size());
}
lua_rawset(L, -3);
}
- HSTR_PUSH_NUMBER(L, "n", unitDefMap.size());
return 1;
}
@@ -1042,7 +1039,6 @@ int LuaUnsyncedRead::GetSelectedUnitsCounts(lua_State* L)
lua_pushnumber(L, mit->second); // push the UnitDef unit count
lua_rawset(L, -3);
}
- HSTR_PUSH_NUMBER(L, "n", countMap.size());
return 1;
}
@@ -1622,7 +1618,6 @@ int LuaUnsyncedRead::GetActiveCmdDescs(lua_State* L)
LuaUtils::PushCommandDesc(L, cmdDescs[i]);
lua_rawset(L, -3);
}
- HSTR_PUSH_NUMBER(L, "n", cmdDescCount);
abma
abma Jun 21, 2011 Owner

according to bbe0028, i think lua_checkstack() has to be changed, too

return 1;
}
@@ -1894,9 +1889,6 @@ int LuaUnsyncedRead::GetConsoleBuffer(lua_State* L)
}
lua_rawset(L, -3);
}
- lua_pushstring(L, "n");
- lua_pushnumber(L, count);
- lua_rawset(L, -3);
return 1;
}
@@ -1958,9 +1950,6 @@ int LuaUnsyncedRead::GetKeyBindings(lua_State* L)
lua_rawset(L, -3);
lua_rawset(L, -3);
}
- lua_pushstring(L, "n");
- lua_pushnumber(L, actions.size());
- lua_rawset(L, -3);
return 1;
}
@@ -1980,9 +1969,6 @@ int LuaUnsyncedRead::GetActionHotKeys(lua_State* L)
lua_pushsstring(L, hotkey);
lua_rawset(L, -3);
}
- lua_pushstring(L, "n");
- lua_pushnumber(L, hotkeys.size());
- lua_rawset(L, -3);
return 1;
}
@@ -2059,7 +2045,6 @@ int LuaUnsyncedRead::GetGroupUnits(lua_State* L)
lua_pushnumber(L, (*it)->id);
lua_rawset(L, -3);
}
- HSTR_PUSH_NUMBER(L, "n", count);
return 1;
}
@@ -2096,11 +2081,9 @@ int LuaUnsyncedRead::GetGroupUnitsSorted(lua_State* L)
lua_pushnumber(L, unit->id);
lua_rawset(L, -3);
}
- HSTR_PUSH_NUMBER(L, "n", v.size());
}
lua_rawset(L, -3);
}
- HSTR_PUSH_NUMBER(L, "n", unitDefMap.size());
return 1;
}
@@ -2138,7 +2121,6 @@ int LuaUnsyncedRead::GetGroupUnitsCounts(lua_State* L)
lua_pushnumber(L, mit->second); // push the UnitDef unit count
lua_rawset(L, -3);
}
- HSTR_PUSH_NUMBER(L, "n", countMap.size());
return 1;
}
View
@@ -873,9 +873,6 @@ void LuaUtils::PushCommandDesc(lua_State* L, const CommandDescription& cd)
lua_rawseti(L, -2, p + 1);
}
- // params["n"] = numParams
- HSTR_PUSH_NUMBER(L, "n", numParams);
-
// CmdDesc["params"] = {[1] = "string1", [2] = "string2", ...}
lua_settable(L, -3);
}
View
@@ -576,9 +576,6 @@ int UnpackType(lua_State* L)
lua_pushnumber(L, value);
lua_rawseti(L, -2, (i + 1));
}
- lua_pushstring(L, "n");
- lua_pushnumber(L, tableCount);
- lua_rawset(L, -3);
return 1;
}
@@ -399,7 +399,6 @@ static int GuiSoundSetTable(lua_State* L, const void* data)
}
lua_rawset(L, -3);
}
- HSTR_PUSH_NUMBER(L, "n", soundCount);
return 1;
}

1 comment on commit 1874b58

@FLOZi
Contributor
FLOZi commented on 1874b58 Jun 21, 2011

Might be good to have a forum announcement about this including a list of the functions affected... :)

Please sign in to comment.