Remove table.insert

This commit is contained in:
Kakarot
2021-11-02 23:16:52 -06:00
parent 427db79af8
commit 9a1f1ab565
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -419,7 +419,7 @@ function QBCore.Player.CreatePlayer(PlayerData)
local slots = QBCore.Player.GetSlotsByItem(self.PlayerData.items, item)
for _, slot in pairs(slots) do
if slot then
table.insert(items, self.PlayerData.items[slot])
items[#items+1] = self.PlayerData.items[slot]
end
end
return items
@@ -569,13 +569,13 @@ QBCore.Player.SaveInventory = function(source)
if items and next(items) then
for slot, item in pairs(items) do
if items[slot] then
table.insert(ItemsJson, {
ItemsJson[#ItemsJson+1] = {
name = item.name,
amount = item.amount,
info = item.info,
type = item.type,
slot = slot,
})
}
end
end
exports.oxmysql:execute('UPDATE players SET inventory = ? WHERE citizenid = ?', { json.encode(ItemsJson), PlayerData.citizenid })
@@ -602,7 +602,7 @@ function QBCore.Player.GetSlotsByItem(items, itemName)
if items then
for slot, item in pairs(items) do
if item.name:lower() == itemName:lower() then
table.insert(slotsFound, slot)
slotsFound[#slotsFound+1] = slot
end
end
end