From fff95ad17916a4e9c1953a3b9e7b78df2345bedc Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 18 May 2010 12:01:37 +0200 Subject: [PATCH] Fixed: #912 Arrays not initialized and other minor bugs --- .../ryzom/client/src/interface_v3/lua_ihm.cpp | 24 ++++++++++++------- .../common/data_common/r2/r2_activities.lua | 2 +- .../common/data_common/r2/r2_base_class.lua | 2 +- .../ryzom/common/data_common/r2/r2_events.lua | 2 +- .../r2/r2_features_proximity_dialog.lua | 2 +- code/ryzom/common/data_common/r2/r2_logic.lua | 2 +- .../data_common/r2/r2_logic_entities.lua | 2 +- .../r2/r2_ui_contextual_commands.lua | 2 +- .../data_common/r2/r2_ui_displayer_npc.lua | 2 +- .../data_common/r2/r2_ui_displayers.lua | 2 +- .../data_common/r2/r2_ui_property_sheet.lua | 2 +- .../common/data_common/r2/r2_ui_triggers.lua | 2 +- 12 files changed, 26 insertions(+), 20 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/lua_ihm.cpp b/code/ryzom/client/src/interface_v3/lua_ihm.cpp index 7ab561c1c..c95deab32 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm.cpp +++ b/code/ryzom/client/src/interface_v3/lua_ihm.cpp @@ -289,11 +289,11 @@ bool CLuaIHM::getUCStringOnStack(CLuaState &ls, sint index, ucstring &dest) void CLuaIHM::push(CLuaState &ls, const ucstring &value) { //H_AUTO(Lua_CLuaIHM_push) -#if LUABIND_VERSION == 600 +#if LUABIND_VERSION > 600 + luabind::detail::push(ls.getStatePointer(), value); +#else luabind::object obj(ls.getStatePointer(), value); obj.pushvalue(); -#else - luabind::detail::push(ls.getStatePointer(), value); #endif } @@ -649,16 +649,20 @@ void CLuaIHM::luaValueFromReflectedProperty(CLuaState &ls, CReflectable &reflect break; case CReflectedProperty::UCString: { +#if LUABIND_VERSION > 600 + luabind::detail::push(ls.getStatePointer(), (reflectedObject.*(property.GetMethod.GetUCString))() ); +#else luabind::object obj(ls.getStatePointer(), (reflectedObject.*(property.GetMethod.GetUCString))() ); -#if LUABIND_VERSION == 600 obj.pushvalue(); #endif } break; case CReflectedProperty::RGBA: { +#if LUABIND_VERSION > 600 + luabind::detail::push(ls.getStatePointer(), (reflectedObject.*(property.GetMethod.GetRGBA))() ); +#else luabind::object obj(ls.getStatePointer(), (reflectedObject.*(property.GetMethod.GetRGBA))()); -#if LUABIND_VERSION == 600 obj.pushvalue(); #endif } @@ -2670,8 +2674,10 @@ int CLuaIHM::runExprAndPushResult(CLuaState &ls, const std::string &expr) // push a ucstring? if(mustUseUCString) { - luabind::object obj(ls.getStatePointer(), ucstr ); -#if LUABIND_VERSION == 600 +#if LUABIND_VERSION > 600 + luabind::detail::push(ls.getStatePointer(), ucstr); +#else + luabind::object obj(ls.getStatePointer(), ucstr); obj.pushvalue(); #endif } @@ -2683,10 +2689,10 @@ int CLuaIHM::runExprAndPushResult(CLuaState &ls, const std::string &expr) } case CInterfaceExprValue::RGBA: { - luabind::object obj(ls.getStatePointer(), value.getRGBA()); #if LUABIND_VERSION > 600 - obj.push(ls.getStatePointer()); + luabind::detail::push(ls.getStatePointer(), value.getRGBA()); #else + luabind::object obj(ls.getStatePointer(), value.getRGBA()); obj.pushvalue(); #endif break; diff --git a/code/ryzom/common/data_common/r2/r2_activities.lua b/code/ryzom/common/data_common/r2/r2_activities.lua index 5a5aea21f..0c29594f8 100644 --- a/code/ryzom/common/data_common/r2/r2_activities.lua +++ b/code/ryzom/common/data_common/r2/r2_activities.lua @@ -1078,7 +1078,7 @@ function r2.activities:initActivityMenu() activityMenu:addSubMenu(activitiesNb) local zonesMenu = activityMenu:getSubMenu(activitiesNb) local zonesTable = r2.Scenario:getAllInstancesByType(zone) - for key, z in zonesTable do + for key, z in pairs(zonesTable) do uc_activity:fromUtf8(z.Name) zonesMenu:addLine(uc_activity, "lua", "r2.activities:setActivityType('"..actType.."', '".. z.InstanceId .."')", z.InstanceId) end diff --git a/code/ryzom/common/data_common/r2/r2_base_class.lua b/code/ryzom/common/data_common/r2/r2_base_class.lua index 9aa751882..b1d2de610 100644 --- a/code/ryzom/common/data_common/r2/r2_base_class.lua +++ b/code/ryzom/common/data_common/r2/r2_base_class.lua @@ -502,7 +502,7 @@ end -- default is to look recursively in the 'son select bar container' function baseClass.getFirstSelectBarSon(this) local sons = this:getSelectBarSons() - if not sons then return nil end + if not sons then return nil end for k, v in specPairs(sons) do if v:displayInSelectBar() then return v diff --git a/code/ryzom/common/data_common/r2/r2_events.lua b/code/ryzom/common/data_common/r2/r2_events.lua index 0946b9a53..0885bc0f3 100644 --- a/code/ryzom/common/data_common/r2/r2_events.lua +++ b/code/ryzom/common/data_common/r2/r2_events.lua @@ -380,7 +380,7 @@ function r2.events:filterEvents(logicEntityId) end table.insert(allLogicEntities, r2.Scenario) - for k0, entity in allLogicEntities do + for k0, entity in pairs(allLogicEntities) do local behavior = self:getBehavior(entity) if not self.memberManagement then -- TEMP diff --git a/code/ryzom/common/data_common/r2/r2_features_proximity_dialog.lua b/code/ryzom/common/data_common/r2/r2_features_proximity_dialog.lua index 291df1795..e7a325aaa 100644 --- a/code/ryzom/common/data_common/r2/r2_features_proximity_dialog.lua +++ b/code/ryzom/common/data_common/r2/r2_features_proximity_dialog.lua @@ -248,7 +248,7 @@ end function component.initLogicEntitiesInstancesMenu(this, subMenu, calledFunction) local entitiesTable = r2.Scenario:getAllInstancesByType(this.Name) - for key, entity in entitiesTable do + for key, entity in pairs(entitiesTable) do local uc_name = ucstring() uc_name:fromUtf8(entity.Name) subMenu:addLine(uc_name, "lua", calledFunction.."('".. entity.InstanceId .."')", entity.InstanceId) diff --git a/code/ryzom/common/data_common/r2/r2_logic.lua b/code/ryzom/common/data_common/r2/r2_logic.lua index 85b33e794..5a83d5b43 100644 --- a/code/ryzom/common/data_common/r2/r2_logic.lua +++ b/code/ryzom/common/data_common/r2/r2_logic.lua @@ -786,7 +786,7 @@ Logic.Components.ChatSequence = { initLogicEntitiesInstancesMenu = function(this, subMenu, calledFunction) local entitiesTable = r2.Scenario:getAllInstancesByType(this.Name) - for key, entity in entitiesTable do + for key, entity in pairs(entitiesTable) do local uc_name = ucstring() uc_name:fromUtf8(entity.Name) subMenu:addLine(uc_name, "lua", calledFunction.."('".. entity.InstanceId .."')", entity.InstanceId) diff --git a/code/ryzom/common/data_common/r2/r2_logic_entities.lua b/code/ryzom/common/data_common/r2/r2_logic_entities.lua index 4e7f20f07..2cbef8bec 100644 --- a/code/ryzom/common/data_common/r2/r2_logic_entities.lua +++ b/code/ryzom/common/data_common/r2/r2_logic_entities.lua @@ -298,7 +298,7 @@ end --function logicEntity.initLogicEntitiesInstancesMenu(this, subMenu, calledFunction) -- -- local entitiesTable = r2.Scenario:getAllInstancesByType(this.Name) --- for key, entity in entitiesTable do +-- for key, entity in pairs(entitiesTable) do -- local uc_name = ucstring() -- uc_name:fromUtf8(entity.Name) -- subMenu:addLine(uc_name, "lua", calledFunction.."('".. entity.InstanceId .."')", entity.InstanceId) diff --git a/code/ryzom/common/data_common/r2/r2_ui_contextual_commands.lua b/code/ryzom/common/data_common/r2/r2_ui_contextual_commands.lua index 7c340d4ac..176cb1d54 100644 --- a/code/ryzom/common/data_common/r2/r2_ui_contextual_commands.lua +++ b/code/ryzom/common/data_common/r2/r2_ui_contextual_commands.lua @@ -83,7 +83,7 @@ function r2.ContextualCommands:update() end -- if one of the command is highlighted, let it highlighted after the toolbar has been rebuilt --local highlightedCommand - --for index, button in self.IndexToButton do + --for index, button in pairs(self.IndexToButton) do -- if button == r2.ToolUI:getActiveToolUI() then -- debugInfo("highlighted command found") -- highlightedCommand = self.CurrentCommands[index] diff --git a/code/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua b/code/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua index 8afb35298..682ff9f18 100644 --- a/code/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua +++ b/code/ryzom/common/data_common/r2/r2_ui_displayer_npc.lua @@ -2193,7 +2193,7 @@ function r2:updateEquipment(instance, init) comboBox:resetTexts() - for k1, v1 in v do + for k1, v1 in pairs(v) do comboBox:addText(ucstring(v1.trad)) end end diff --git a/code/ryzom/common/data_common/r2/r2_ui_displayers.lua b/code/ryzom/common/data_common/r2/r2_ui_displayers.lua index fa7e6e4a2..b1e0fb156 100644 --- a/code/ryzom/common/data_common/r2/r2_ui_displayers.lua +++ b/code/ryzom/common/data_common/r2/r2_ui_displayers.lua @@ -722,7 +722,7 @@ r2.ActUIDisplayer.LastSelfCreatedActInstanceId = nil -- id of the last act creat for i = 0, r2:getMaxNumberOfAdditionnalActs() - 1 do local tree = self:getContainer():find(treeName .. tostring(i)) local used = false - for index, entry in self:getActTable() do + for index, entry in pairs(self:getActTable()) do local entryTree = entry.Tree if macroTree==true then entryTree = entry.MacroTree end if entryTree == tree then diff --git a/code/ryzom/common/data_common/r2/r2_ui_property_sheet.lua b/code/ryzom/common/data_common/r2/r2_ui_property_sheet.lua index fd41c78ce..a146f71c9 100644 --- a/code/ryzom/common/data_common/r2/r2_ui_property_sheet.lua +++ b/code/ryzom/common/data_common/r2/r2_ui_property_sheet.lua @@ -1889,7 +1889,7 @@ function r2:buildAllPropertySheetsAndForms() --debugInfo('building forms') if r2.Forms ~= nil then - for formName, form in r2.Forms do + for formName, form in pairs(r2.Forms) do local mustRebuild = true if r2FormsCache[formName] ~= nil then if isEqualIgnoreFunctions(r2FormsCache[formName], form.Prop) then diff --git a/code/ryzom/common/data_common/r2/r2_ui_triggers.lua b/code/ryzom/common/data_common/r2/r2_ui_triggers.lua index c7edeb2bc..2263c0705 100644 --- a/code/ryzom/common/data_common/r2/r2_ui_triggers.lua +++ b/code/ryzom/common/data_common/r2/r2_ui_triggers.lua @@ -903,7 +903,7 @@ function r2:openActivityMenu() -- activityMenu:addSubMenu(6) -- local regionsMenu = activityMenu:getSubMenu(6) -- local regionsTable = r2.Scenario:getAllInstancesByType("Region") --- for key, region in regionsTable do +-- for key, region in pairs(regionsTable) do -- regionsMenu:addLine(ucstring(region.Name), "lua", "r2:setActivity('Deploy', '".. region.InstanceId .."')", region.InstanceId) -- end -- if table.getn(regionsTable) == 0 then