diff --git a/[esx]/es_extended/client/functions.lua b/[esx]/es_extended/client/functions.lua index 1a082d94..25a5facf 100644 --- a/[esx]/es_extended/client/functions.lua +++ b/[esx]/es_extended/client/functions.lua @@ -145,7 +145,7 @@ function ESX.UI.HUD.RegisterElement(name, index, priority, html, data) return end - table.insert(ESX.UI.HUD.RegisteredElements, name) + ESX.UI.HUD.RegisteredElements[#ESX.UI.HUD.RegisteredElements + 1] = name SendNUIMessage({ action = 'insertHUDElement', @@ -274,7 +274,7 @@ function ESX.UI.Menu.Open(type, namespace, name, data, submit, cancel, change, c end end - table.insert(ESX.UI.Menu.Opened, menu) + ESX.UI.Menu.Opened[#ESX.UI.Menu.Opened + 1] = menu ESX.UI.Menu.RegisteredTypes[type].open(namespace, name, data) return menu @@ -444,7 +444,7 @@ function ESX.Game.GetPeds(onlyOtherPeds) for i=1, #pool do if ((onlyOtherPeds and pool[i] ~= myPed) or not onlyOtherPeds) then - table.insert(peds, pool[i]) + peds[#peds + 1] = pool[i] end end @@ -465,7 +465,7 @@ function ESX.Game.GetPlayers(onlyOtherPlayers, returnKeyValue, returnPeds) if returnKeyValue then players[player] = ped else - table.insert(players, returnPeds and ped or player) + players[#players + 1] = returnPeds and ped or player end end end @@ -503,7 +503,7 @@ local function EnumerateEntitiesWithinDistance(entities, isPlayerEntities, coord local distance = #(coords - GetEntityCoords(entity)) if distance <= maxDistance then - table.insert(nearbyEntities, isPlayerEntities and k or entity) + nearbyEntities[#nearbyEntities + 1] = isPlayerEntities and k or entity end end @@ -538,7 +538,7 @@ function ESX.Game.GetClosestEntity(entities, isPlayerEntities, coords, modelFilt for k,entity in pairs(entities) do if modelFilter[GetEntityModel(entity)] then - table.insert(filteredEntities, entity) + filteredEntities[#filteredEntities + 1] = entity end end end diff --git a/[esx]/es_extended/server/classes/player.lua b/[esx]/es_extended/server/classes/player.lua index 28aab1ca..1243c6d1 100644 --- a/[esx]/es_extended/server/classes/player.lua +++ b/[esx]/es_extended/server/classes/player.lua @@ -167,7 +167,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, for k2,component in ipairs(v.components) do if component ~= 'clip_default' then - table.insert(components, component) + components[#components + 1] = component end end @@ -420,7 +420,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, if component then if not self.hasWeaponComponent(weaponName, weaponComponent) then - table.insert(self.loadout[loadoutNum].components, weaponComponent) + self.loadout[loadoutNum].components[#self.loadout[loadoutNum].components + 1] = weaponComponent self.triggerEvent('esx:addWeaponComponent', weaponName, weaponComponent) self.triggerEvent('esx:addInventoryItem', component.label, false, true) end diff --git a/[esx]/es_extended/server/functions.lua b/[esx]/es_extended/server/functions.lua index 8f144baf..7c8a11a6 100644 --- a/[esx]/es_extended/server/functions.lua +++ b/[esx]/es_extended/server/functions.lua @@ -213,7 +213,7 @@ function ESX.GetPlayers() local sources = {} for k,v in pairs(ESX.Players) do - table.insert(sources, k) + sources[#sources + 1] = k end return sources @@ -224,10 +224,10 @@ function ESX.GetExtendedPlayers(key, val) for k, v in pairs(ESX.Players) do if key then if (key == 'job' and v.job.name == val) or v[key] == val then - table.insert(xPlayers, v) + xPlayers[#xPlayers + 1] = v end else - table.insert(xPlayers, v) + xPlayers[#xPlayers + 1] = v end end return xPlayers