I think this is correct way to use iterate over it as a hashmap. don't have much lua practice
--- 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()