Skip to content

Commit 150a1d4

Browse files
authored
Replace player/ents.GetAll with player/ents.Iterator (#3401)
* Replace player/ents.GetAll with player/ents.Iterator These functions are now completely stable! Now it does not have any negative effects * Fix
1 parent 3aa11a7 commit 150a1d4

File tree

9 files changed

+17
-17
lines changed

9 files changed

+17
-17
lines changed

lua/entities/gmod_wire_expression2/core/extloader.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ if ENT then
5252
_Msg( "Calling constructors for all Expression 2 chips." )
5353
wire_expression2_prepare_functiondata()
5454
if not args or args[1] ~= "nosend" then
55-
for _, p in ipairs( player.GetAll() ) do
55+
for _, p in player.Iterator() do
5656
if IsValid( p ) then wire_expression2_sendfunctions( p ) end
5757
end
5858
end

lua/entities/gmod_wire_expression2/core/hologram.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,7 +1571,7 @@ concommand.Add( "wire_holograms_block", function( ply, com, args )
15711571
clearholos_all(uid)
15721572
end
15731573
BlockList[v:SteamID()] = true
1574-
for _,p in ipairs( player.GetAll() ) do
1574+
for _,p in player.Iterator() do
15751575
p:PrintMessage( HUD_PRINTTALK, "(ADMIN) " .. v:GetName() .. " added to holograms blocklist" )
15761576
end
15771577
end
@@ -1598,7 +1598,7 @@ concommand.Add( "wire_holograms_unblock", function( ply, com, args )
15981598
local v = players[1]
15991599
if BlockList[v:SteamID()] == true then
16001600
BlockList[v:SteamID()] = nil
1601-
for _,player in ipairs( player.GetAll() ) do
1601+
for _,player in player.Iterator() do
16021602
player:PrintMessage( HUD_PRINTTALK, "(ADMIN) " .. v:GetName() .. " removed from holograms blocklist" )
16031603
end
16041604
else
@@ -1626,11 +1626,11 @@ concommand.Add( "wire_holograms_block_id", function( ply, com, args )
16261626
ConsoleMessage( ply, steamID .. " is already in the holograms blocklist!" )
16271627
else
16281628
BlockList[steamID] = true
1629-
for _,player in ipairs( player.GetAll() ) do
1629+
for _,player in player.Iterator() do
16301630
player:PrintMessage( HUD_PRINTTALK, "(ADMIN) " .. steamID .. " added to holograms blocklist" )
16311631
end
16321632
local uid
1633-
for _,v in ipairs( player.GetAll() ) do
1633+
for _,v in player.Iterator() do
16341634
if v:SteamID() == steamID then
16351635
uid = v:UniqueID()
16361636
if (E2HoloRepo[uid]) then
@@ -1655,7 +1655,7 @@ concommand.Add( "wire_holograms_unblock_id", function( ply, com, args )
16551655

16561656
if BlockList[steamID] == true then
16571657
BlockList[steamID] = nil
1658-
for _,player in ipairs( player.GetAll() ) do
1658+
for _,player in player.Iterator() do
16591659
player:PrintMessage( HUD_PRINTTALK, "(ADMIN) " .. steamID .. " removed from holograms blocklist" )
16601660
end
16611661
else

lua/entities/gmod_wire_expression2/core/player.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ end
739739
e2function array playersAdmins()
740740
local admins = {}
741741

742-
for _, ply in ipairs(player.GetAll()) do
742+
for _, ply in player.Iterator() do
743743
if ply:IsAdmin() then
744744
table.insert(admins, ply)
745745
end
@@ -751,7 +751,7 @@ end
751751
e2function array playersSuperAdmins()
752752
local superadmins = {}
753753

754-
for _, ply in ipairs(player.GetAll()) do
754+
for _, ply in player.Iterator() do
755755
if ply:IsSuperAdmin() then
756756
table.insert(superadmins, ply)
757757
end

lua/entities/gmod_wire_graphics_tablet.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function ENT:Think()
114114
local x = -w/2
115115
local y = -h/2
116116

117-
for _,ply in pairs(player.GetAll()) do
117+
for _,ply in player.Iterator() do
118118
local trace = ply:GetEyeTraceNoCursor()
119119
local ent = trace.Entity
120120
if ent:IsValid() then

lua/entities/gmod_wire_hologram.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ if CLIENT then
378378
end,
379379
function(cmd)
380380
local help = {}
381-
for _, ply in ipairs(player.GetAll()) do
381+
for _, ply in player.Iterator() do
382382
table.insert(help, cmd.." \""..ply:SteamID().."\" // "..ply:Name())
383383
end
384384
return help

lua/entities/gmod_wire_hudindicator/init.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ function ENT:LinkEnt(pod)
288288

289289
local ply = nil
290290
-- Check if a player is in pod first
291-
for _, v in pairs(player.GetAll()) do
291+
for _, v in player.Iterator() do
292292
if (v:GetVehicle() == pod) then
293293
ply = v
294294
break
@@ -331,7 +331,7 @@ function ENT:Think()
331331
local ply = nil
332332

333333
if not IsValid(self.PodPly) or self.PodPly:GetVehicle() ~= self.Pod then
334-
for _, v in pairs(player.GetAll()) do
334+
for _, v in player.Iterator() do
335335
if (v:GetVehicle() == self.Pod) then
336336
ply = v
337337
break

lua/wire/flir.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ end
111111
function FLIR.start()
112112
if FLIR.enabled then return else FLIR.enabled = true end
113113

114-
for _, v in ipairs(ents.GetAll()) do
114+
for _, v in ents.Iterator() do
115115
SetFLIR(v)
116116
end
117117

@@ -190,7 +190,7 @@ function FLIR.stop()
190190
hook.Remove("OnEntityCreated", "wire_flir")
191191
hook.Remove("CreateClientsideRagdoll", "wire_flir")
192192

193-
for _, v in ipairs(ents.GetAll()) do
193+
for _, v in ents.Iterator() do
194194
RemoveFLIR(v)
195195
end
196196
end

lua/wire/server/wirelib.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,13 +1581,13 @@ function WireLib.NotifyGroup(group, msg, severity, chatprint, color)
15811581
local plys = {}
15821582

15831583
if isstring(group) then
1584-
for _, p in ipairs(player.GetAll()) do
1584+
for _, p in player.Iterator() do
15851585
if p:GetUserGroup() == group then
15861586
plys[#plys + 1] = p
15871587
end
15881588
end
15891589
else
1590-
for _, p in ipairs(player.GetAll()) do
1590+
for _, p in player.Iterator() do
15911591
if table.HasValue(group, p:GetUserGroup()) then
15921592
plys[#plys + 1] = p
15931593
end

lua/wire/wire_paths.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function WireLib.Paths.Add(input, ply)
101101
if ply then
102102
table.insert(transmit_queues[ply], input)
103103
else
104-
for _, player in pairs(player.GetAll()) do
104+
for _, player in player.Iterator() do
105105
table.insert(transmit_queues[player], input)
106106
end
107107
end

0 commit comments

Comments
 (0)