diff --git a/gamemode/core/derma/cl_inventory.lua b/gamemode/core/derma/cl_inventory.lua index 22505e40..2addb4f3 100644 --- a/gamemode/core/derma/cl_inventory.lua +++ b/gamemode/core/derma/cl_inventory.lua @@ -774,12 +774,12 @@ hook.Add("CreateMenuButtons", "ixInventory", function(tabs) ix.gui.inv1 = panel if (ix.option.Get("openBags", true)) then - for _, v in inventory:Iter() do - if (!v.isBag) then + for k, _ in inventory:Iter() do + if (!k.isBag) then continue end - v.functions.View.OnClick(v) + k.functions.View.OnClick(k) end end diff --git a/gamemode/core/hooks/sh_hooks.lua b/gamemode/core/hooks/sh_hooks.lua index b28d92c8..9622e8a9 100644 --- a/gamemode/core/hooks/sh_hooks.lua +++ b/gamemode/core/hooks/sh_hooks.lua @@ -575,8 +575,8 @@ function GM:CanTransferItem(itemObject, curInv, inventory) -- don't allow transferring items that are in use if (inventory) then - for _, v in inventory:Iter() do - if (v:GetData("equip") == true) then + for k, _ in inventory:Iter() do + if (k:GetData("equip") == true) then local owner = itemObject:GetOwner() if (owner and IsValid(owner)) then diff --git a/gamemode/core/hooks/sv_hooks.lua b/gamemode/core/hooks/sv_hooks.lua index dd96c2f0..9604ce15 100644 --- a/gamemode/core/hooks/sv_hooks.lua +++ b/gamemode/core/hooks/sv_hooks.lua @@ -564,12 +564,12 @@ function GM:PostPlayerLoadout(client) local character = client:GetCharacter() if (character:GetInventory()) then - for _, v in character:GetInventory():Iter() do - v:Call("OnLoadout", client) + for k, _ in character:GetInventory():Iter() do + k:Call("OnLoadout", client) - if (v:GetData("equip") and v.attribBoosts) then - for attribKey, attribValue in pairs(v.attribBoosts) do - character:AddBoost(v.uniqueID, attribKey, attribValue) + if (k:GetData("equip") and k.attribBoosts) then + for attribKey, attribValue in pairs(k.attribBoosts) do + character:AddBoost(k.uniqueID, attribKey, attribValue) end end end @@ -870,9 +870,9 @@ end function GM:CharacterPreSave(character) local client = character:GetPlayer() - for _, v in character:GetInventory():Iter() do - if (v.OnSave) then - v:Call("OnSave", client) + for k, _ in character:GetInventory():Iter() do + if (k.OnSave) then + k:Call("OnSave", client) end end diff --git a/gamemode/core/libs/sh_storage.lua b/gamemode/core/libs/sh_storage.lua index f83dc135..4b5960f3 100644 --- a/gamemode/core/libs/sh_storage.lua +++ b/gamemode/core/libs/sh_storage.lua @@ -95,9 +95,9 @@ if (SERVER) then inventory.storageInfo = info -- remove context from any bags this inventory might have - for _, v in inventory:Iter() do - if (v.isBag and v:GetInventory()) then - ix.storage.CreateContext(v:GetInventory(), table.Copy(info)) + for k, _ in inventory:Iter() do + if (k.isBag and k:GetInventory()) then + ix.storage.CreateContext(k:GetInventory(), table.Copy(info)) end end end @@ -110,9 +110,9 @@ if (SERVER) then inventory.storageInfo = nil -- remove context from any bags this inventory might have - for _, v in inventory:Iter() do - if (v.isBag and v:GetInventory()) then - ix.storage.RemoveContext(v:GetInventory()) + for k, _ in inventory:Iter() do + if (k.isBag and k:GetInventory()) then + ix.storage.RemoveContext(k:GetInventory()) end end end @@ -159,9 +159,9 @@ if (SERVER) then client.ixOpenStorage = inventory -- update receivers for any bags this inventory might have - for _, v in inventory:Iter() do - if (v.isBag and v:GetInventory()) then - v:GetInventory():AddReceiver(client) + for k, _ in inventory:Iter() do + if (k.isBag and k:GetInventory()) then + k:GetInventory():AddReceiver(client) end end @@ -192,9 +192,9 @@ if (SERVER) then inventory:RemoveReceiver(client) -- update receivers for any bags this inventory might have - for _, v in inventory:Iter() do - if (v.isBag and v:GetInventory()) then - v:GetInventory():RemoveReceiver(client) + for k, _ in inventory:Iter() do + if (k.isBag and k:GetInventory()) then + k:GetInventory():RemoveReceiver(client) end end diff --git a/gamemode/core/meta/sh_inventory.lua b/gamemode/core/meta/sh_inventory.lua index 1b1d139d..ffd3db3c 100644 --- a/gamemode/core/meta/sh_inventory.lua +++ b/gamemode/core/meta/sh_inventory.lua @@ -84,7 +84,7 @@ end -- this is pretty good to debug/develop function to use. function META:Print(printPos) - for k, v in self:Iter() do + for k, v in pairs(self:GetItems()) do local str = k .. ": " .. v.name if (printPos) then @@ -102,19 +102,19 @@ end -- This function can be helpful for getting rid of those pesky errors. -- @realm shared function META:FindError() - for _, v in self:Iter() do - if (v.width == 1 and v.height == 1) then + for k, _ in self:Iter() do + if (k.width == 1 and k.height == 1) then continue end - print("Finding error: " .. v.name) - print("Item Position: " .. v.gridX, v.gridY) + print("Finding error: " .. k.name) + print("Item Position: " .. k.gridX, k.gridY) - for x = v.gridX, v.gridX + v.width - 1 do - for y = v.gridY, v.gridY + v.height - 1 do + for x = k.gridX, k.gridX + k.width - 1 do + for y = k.gridY, k.gridY + k.height - 1 do local item = self.slots[x][y] - if (item and item.id != v.id) then + if (item and item.id != k.id) then print("Error Found: ".. item.name) end end @@ -619,10 +619,10 @@ end -- -- do something with the item table -- end function META:HasItem(targetID, data) - for _, v in self:Iter() do - if (v.uniqueID == targetID) then + for k, _ in self:Iter() do + if (k.uniqueID == targetID) then if (data) then - local itemData = v.data + local itemData = k.data local bFound = true for dataKey, dataVal in pairs(data) do @@ -637,7 +637,7 @@ function META:HasItem(targetID, data) end end - return v + return k end end @@ -661,9 +661,9 @@ function META:HasItems(targetIDs) local count = #targetIDs -- assuming array targetIDs = table.Copy(targetIDs) - for _, v in self:Iter() do + for item, _ in self:Iter() do for k, targetID in ipairs(targetIDs) do - if (v.uniqueID == targetID) then + if (item.uniqueID == targetID) then table.remove(targetIDs, k) count = count - 1 @@ -692,10 +692,10 @@ end -- end -- -- Notifies the player that they should get some more guns. function META:HasItemOfBase(baseID, data) - for _, v in self:Iter() do - if (v.base == baseID) then + for k, _ in self:Iter() do + if (k.base == baseID) then if (data) then - local itemData = v.data + local itemData = k.data local bFound = true for dataKey, dataVal in pairs(data) do @@ -710,7 +710,7 @@ function META:HasItemOfBase(baseID, data) end end - return v + return k end end @@ -955,8 +955,8 @@ if (SERVER) then net.WriteTable(self.vars or {}) net.Send(receiver) - for _, v in self:Iter() do - v:Call("OnSendData", receiver) + for k, _ in self:Iter() do + k:Call("OnSendData", receiver) end end end diff --git a/gamemode/core/meta/sh_item.lua b/gamemode/core/meta/sh_item.lua index 2f4bf982..a95845d6 100644 --- a/gamemode/core/meta/sh_item.lua +++ b/gamemode/core/meta/sh_item.lua @@ -437,11 +437,11 @@ function ITEM:Remove(bNoReplication, bNoDelete) if (failed) then inv.slots = {} - for _, v in inv:Iter() do - if (v.invID == inv:GetID()) then + for k, _ in inv:Iter() do + if (k.invID == inv:GetID()) then for x = self.gridX, self.gridX + (self.width - 1) do for y = self.gridY, self.gridY + (self.height - 1) do - inv.slots[x][y] = v.id + inv.slots[x][y] = k.id end end end diff --git a/gamemode/items/base/sh_bags.lua b/gamemode/items/base/sh_bags.lua index 660726c1..9c1016f1 100644 --- a/gamemode/items/base/sh_bags.lua +++ b/gamemode/items/base/sh_bags.lua @@ -208,8 +208,8 @@ function ITEM:CanTransfer(oldInventory, newInventory) return false end - for _, v in self:GetInventory():Iter() do - if (v:GetData("id") == index2) then + for k, _ in self:GetInventory():Iter() do + if (k:GetData("id") == index2) then return false end end diff --git a/gamemode/items/base/sh_outfit.lua b/gamemode/items/base/sh_outfit.lua index 8c4e687d..aced4829 100644 --- a/gamemode/items/base/sh_outfit.lua +++ b/gamemode/items/base/sh_outfit.lua @@ -265,11 +265,11 @@ ITEM.functions.Equip = { local client = item.player local char = client:GetCharacter() - for _, v in char:GetInventory():Iter() do - if (v.id != item.id) then - local itemTable = ix.item.instances[v.id] + for k, _ in char:GetInventory():Iter() do + if (k.id != item.id) then + local itemTable = ix.item.instances[k.id] - if (itemTable.pacData and v.outfitCategory == item.outfitCategory and itemTable:GetData("equip")) then + if (itemTable.pacData and k.outfitCategory == item.outfitCategory and itemTable:GetData("equip")) then client:NotifyLocalized(item.equippedNotify or "outfitAlreadyEquipped") return false end diff --git a/gamemode/items/base/sh_pacoutfit.lua b/gamemode/items/base/sh_pacoutfit.lua index a9e8b2e6..8ebbe156 100644 --- a/gamemode/items/base/sh_pacoutfit.lua +++ b/gamemode/items/base/sh_pacoutfit.lua @@ -113,11 +113,11 @@ ITEM.functions.Equip = { OnRun = function(item) local char = item.player:GetCharacter() - for _, v in char:GetInventory():Iter() do - if (v.id != item.id) then - local itemTable = ix.item.instances[v.id] + for k, _ in char:GetInventory():Iter() do + if (k.id != item.id) then + local itemTable = ix.item.instances[k.id] - if (itemTable.pacData and v.outfitCategory == item.outfitCategory and itemTable:GetData("equip")) then + if (itemTable.pacData and k.outfitCategory == item.outfitCategory and itemTable:GetData("equip")) then item.player:NotifyLocalized(item.equippedNotify or "outfitAlreadyEquipped") return false diff --git a/gamemode/items/base/sh_weapons.lua b/gamemode/items/base/sh_weapons.lua index 8ef671e8..22f76dc3 100644 --- a/gamemode/items/base/sh_weapons.lua +++ b/gamemode/items/base/sh_weapons.lua @@ -122,9 +122,9 @@ end function ITEM:Equip(client, bNoSelect, bNoSound) client.carryWeapons = client.carryWeapons or {} - for _, v in client:GetCharacter():GetInventory():Iter() do - if (v.id != self.id) then - local itemTable = ix.item.instances[v.id] + for k, _ in client:GetCharacter():GetInventory():Iter() do + if (k.id != self.id) then + local itemTable = ix.item.instances[k.id] if (!itemTable) then client:NotifyLocalized("tellAdmin", "wid!xt") @@ -287,13 +287,13 @@ end hook.Add("PlayerDeath", "ixStripClip", function(client) client.carryWeapons = {} - for _, v in client:GetCharacter():GetInventory():Iter() do - if (v.isWeapon and v:GetData("equip")) then - v:SetData("ammo", nil) - v:SetData("equip", nil) + for k, _ in client:GetCharacter():GetInventory():Iter() do + if (k.isWeapon and k:GetData("equip")) then + k:SetData("ammo", nil) + k:SetData("equip", nil) - if (v.pacData) then - v:RemovePAC(client) + if (k.pacData) then + k:RemovePAC(client) end end end diff --git a/plugins/logging.lua b/plugins/logging.lua index 1df095c3..043057fb 100644 --- a/plugins/logging.lua +++ b/plugins/logging.lua @@ -204,8 +204,8 @@ if (SERVER) then return end - for _, v in bagInventory:Iter() do - ix.log.Add(character:GetPlayer(), "inventoryAdd", character:GetName(), v:GetName(), v:GetID()) + for k, _ in bagInventory:Iter() do + ix.log.Add(character:GetPlayer(), "inventoryAdd", character:GetName(), k:GetName(), k:GetID()) end end end diff --git a/plugins/pac.lua b/plugins/pac.lua index f89cd2c9..01e864f7 100644 --- a/plugins/pac.lua +++ b/plugins/pac.lua @@ -121,9 +121,9 @@ if (SERVER) then if (curChar) then local inv = curChar:GetInventory() - for _, v in inv:Iter() do - if (v:GetData("equip") == true and v.pacData) then - client:AddPart(v.uniqueID, v) + for k, _ in inv:Iter() do + if (k:GetData("equip") == true and k.pacData) then + client:AddPart(k.uniqueID, k) end end end @@ -156,9 +156,9 @@ if (SERVER) then local character = client:GetCharacter() local inventory = character:GetInventory() - for _, v in inventory:Iter() do - if (v:GetData("equip") == true and v.pacData) then - client:AddPart(v.uniqueID, v) + for k, _ in inventory:Iter() do + if (k:GetData("equip") == true and k.pacData) then + client:AddPart(k.uniqueID, k) end end end diff --git a/plugins/vendor/sh_plugin.lua b/plugins/vendor/sh_plugin.lua index 115833fd..86875303 100644 --- a/plugins/vendor/sh_plugin.lua +++ b/plugins/vendor/sh_plugin.lua @@ -358,11 +358,11 @@ if (SERVER) then local invOkay = true - for _, v in client:GetCharacter():GetInventory():Iter() do - if (v.uniqueID == uniqueID and v:GetID() != 0 and ix.item.instances[v:GetID()] and v:GetData("equip", false) == false) then - invOkay = v:Remove() + for k, _ in client:GetCharacter():GetInventory():Iter() do + if (k.uniqueID == uniqueID and k:GetID() != 0 and ix.item.instances[k:GetID()] and k:GetData("equip", false) == false) then + invOkay = k:Remove() found = true - name = L(v.name, client) + name = L(k.name, client) break end