Skip to content
Draft
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
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@
![758e7672ed29e3acd633a4826ed5578f](https://github.com/user-attachments/assets/489d4171-4c06-49c2-a481-0330f58bc322)
![fc934fdc3a3f8116a187c6bebae03060](https://github.com/user-attachments/assets/0cfaeead-c9f1-4249-ae9b-30c679b7f42d)
![a690e160c76c9a36b61f675e232cac57](https://github.com/user-attachments/assets/77b19c50-b726-443f-925b-2ff5310f3606)
![b60f6548f7c8c11297aeffa32699886a](https://github.com/user-attachments/assets/62fb0c2d-3224-44dc-9fad-4d60b96ec1dc)

![b60f6548f7c8c11297aeffa32699886a](https://github.com/user-attachments/assets/62fb0c2d-3224-44dc-9fad-4d60b96ec1dc)
21 changes: 11 additions & 10 deletions lua/autorun/gprofiler_load.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GProfiler = GProfiler or { Config = {}, Access = {} }
GProfiler = GProfiler or { Config = {}, Access = {}, Utils = {} }

local logLevels = {
[1] = {"DEBUG", Color(0, 255, 0)},
Expand All @@ -20,29 +20,30 @@ end
local incFuncs = {
sv = SERVER and include or function() end,
cl = SERVER and AddCSLuaFile or include,
sh = function(f) include(f) AddCSLuaFile(f) end
sh = function(f) include(f) AddCSLuaFile(f) end,
nl = function() end
}

local function incFile(f)
(incFuncs[string.GetFileFromFilename(f):sub(1,2)] or incFuncs.sh)(f)
GProfiler.Log(string.format("Loading file %s", f), 5)
GProfiler.Log(string.format("Loaded file %s", f), 5)
end

local function incFolder(folder, fileOnly)
local function incFolder(folder, subFileOnly, fileOnly)
GProfiler.Log(string.format("Loading folder %s", folder), 5)

local files, folders = file.Find(folder.."/*", "LUA")
for _, f in ipairs(files) do incFile(string.format("%s/%s", folder, f)) end
for _, f in SortedPairs(files, CLIENT) do incFile(string.format("%s/%s", folder, f)) end

if fileOnly then return end
for _, f in ipairs(folders) do incFolder(folder.."/"..f, true) end
for _, f in ipairs(folders) do incFolder(folder.."/"..f, nil, subFileOnly) end
end

incFile("gprofiler/sv_init.lua")
incFile("gprofiler/sh_config.lua")
incFile("gprofiler/sh_utils.lua")
incFile("gprofiler/cl_language.lua")
incFile("gprofiler/cl_menu.lua")
incFile("gprofiler/sh_access.lua")
incFolder("gprofiler/profilers")
incFolder("gprofiler/modules")
incFolder("gprofiler/profilers", true)

hook.Run("GProfiler.Loaded")
GProfiler.Ready = true
Loading