Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimizations #207

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lua/ulx/modules/cl/xgui_client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ function xgui.PermissionsChanged( ply )
xgui.processModules()
local types = {}
for dtype, data in pairs( xgui.data ) do
if table.Count( data ) > 0 then table.insert( types, dtype ) end
if not table.IsEmpty(data) then table.insert( types, dtype ) end
end
RunConsoleCommand( "xgui", "refreshdata", unpack( types ) )
end
Expand Down
8 changes: 4 additions & 4 deletions lua/ulx/modules/cl/xlib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ function xlib.makecombobox( t )

--Garrys function with no comments, just adding support for Spacers and setting the skin.
function pnl:OpenMenu()
if ( #self.Choices == 0 ) then return end
if ( table.IsEmpty(self.Choices) ) then return end
if ( IsValid( self.Menu ) ) then
self.Menu:Remove()
self.Menu = nil
Expand Down Expand Up @@ -1126,14 +1126,14 @@ xlib.animQueue_forceStop = function()
end

xlib.animQueue_call = function()
if #xlib.animQueue > 0 then
if not table.IsEmpty(xlib.animQueue) then
local func = xlib.animQueue[1]
table.remove( xlib.animQueue, 1 )
func()
else
xlib.animRunning = nil
--Check for queues in the backup that haven't been started.
if #xlib.animBackupQueue > 0 then
if not table.IsEmpty(xlib.animBackupQueue) then
xlib.animQueue = table.Copy( xlib.animBackupQueue )
xlib.animBackupQueue = {}
xlib.animQueue_start()
Expand Down Expand Up @@ -1198,4 +1198,4 @@ local function fadeAnim_end( data )
if data.panelOut then data.panelOut:SetVisible( false ) end
if data.panelIn then data.panelIn:SetAlpha( 255 ) end
end
xlib.registerAnimType( "pnlFade", fadeAnim_run, fadeAnim_start, fadeAnim_end )
xlib.registerAnimType( "pnlFade", fadeAnim_run, fadeAnim_start, fadeAnim_end )
4 changes: 2 additions & 2 deletions lua/ulx/modules/xgui_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function xgui.init()
if type( plys ) == "Player" then
plys = { plys }
elseif #plys == 0 then
for _, v in pairs( player.GetAll() ) do
for _, v in ipairs( player.GetAll() ) do
table.insert( plys, v )
end
end
Expand Down Expand Up @@ -324,7 +324,7 @@ function xgui.postInit()
for _, v in ipairs( xgui.svmodules ) do if v.postinit then v.postinit() end end

--Fix any users who requested data before the server was ready
for _, ply in pairs( player.GetAll() ) do
for _, ply in ipairs( player.GetAll() ) do
for UID, data in pairs( xgui.activeUsers ) do
if ply:UniqueID() == UID then
ULib.clientRPC( ply, "xgui.getChunk", -1, "Initializing..." )
Expand Down
2 changes: 1 addition & 1 deletion lua/ulx/xgui/bans.lua
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ function xgui.ShowBanWindow( ply, ID, doFreeze, isUpdate, bandata )
local name
if not isUpdate then
name = xlib.makecombobox{ x=75, y=30, w=200, parent=xgui_banwindow, enableinput=true, selectall=true }
for k,v in pairs( player.GetAll() ) do
for k,v in ipairs( player.GetAll() ) do
name:AddChoice( v:Nick(), v:SteamID() )
end
name.OnSelect = function( self, index, value, data )
Expand Down