I think this is correct way to use iterate over it as a hashmap. don't have much lua practice
authornemo
Wed, 21 Nov 2018 15:41:43 -0500
changeset 14266 9b5a8147386f
parent 14265 2b54c956813e
child 14267 b6c24abb247b
I think this is correct way to use iterate over it as a hashmap. don't have much lua practice
share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua	Wed Nov 21 15:28:52 2018 -0500
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Mutant.lua	Wed Nov 21 15:41:43 2018 -0500
@@ -535,11 +535,11 @@
             SetGearAIHints(hhs[i], aihDoesntMatter)
         end
     end
-    for i = 0, #crates do
-        if CurrentHedgehog == mutant and crate[i] ~= nil  then
-            SetGearAIHints(crates[i], aihDoesntMatter)
+    for k,v in pairs(crates) do
+        if CurrentHedgehog == mutant and v ~= nil  then
+            SetGearAIHints(v, aihDoesntMatter)
         else
-            SetGearAIHints(crates[i], aihUsualProcessing)
+            SetGearAIHints(v, aihUsualProcessing)
         end
     end
 end
@@ -729,7 +729,7 @@
         numhhs = numhhs + 1
         SetEffect(gear, heResurrectable, 1)
     elseif GetGearType(gear) == gtCase then
-        crates[#crates] = gear
+        crates[gear] = gear
     elseif GetGearType(gear) == gtATFinishGame then
         if not gameOver then
             local winner = createEndGameStats()