Skip to content

Commit

Permalink
Patch 1
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown-gd committed Apr 18, 2023
1 parent b90749b commit 92615f3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lua/gpm/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CreateConVar( "gpm_cache_lifetime", "24", FCVAR_ARCHIVE, " - the cache lifetime,

module( "gpm" )

_VERSION = 010400
_VERSION = 010401

-- Include function
function includeShared( filePath )
Expand Down
10 changes: 5 additions & 5 deletions lua/gpm/sources/lua.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ Import = promise.Async( function( filePath, parentPackage, isAutorun )
} )
end

if isAutorun and not metadata.autorun then
logger:Debug( "package autorun restricted (%s)", metadata.name .. "@" .. utils.Version( metadata.version ) )
return
end

if SERVER and metadata.client then
AddCSLuaFile( packageFilePath )
end
Expand Down Expand Up @@ -129,5 +124,10 @@ Import = promise.Async( function( filePath, parentPackage, isAutorun )
if not metadata.server then return end
end

if isAutorun and not metadata.autorun then
logger:Debug( "package autorun restricted (%s)", metadata.name .. "@" .. utils.Version( metadata.version ) )
return
end

return packages.Initialize( metadata, func, Files, parentPackage )
end )
21 changes: 11 additions & 10 deletions lua/gpm/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,17 @@ do

end

function table.Lookup( tbl, path, default )
for _, key in ipairs( string.Split( path, "." ) ) do
function table.Lookup( tbl, str, default )
for _, key in ipairs( string.Split( str, "." ) ) do
tbl = tbl[ key ]
if not tbl then return default end
end

return tbl
end

function table.SetValue( tbl, path, value, ifEmpty )
local keys = string.Split( path, "." )
function table.SetValue( tbl, str, value, ifEmpty )
local keys = string.Split( str, "." )
local count = #keys

for num, key in ipairs( keys ) do
Expand All @@ -214,16 +214,17 @@ function table.SetValue( tbl, path, value, ifEmpty )
end

tbl[ key ] = value
break
return value
end

tbl = tbl[ key ]

if tbl == nil then
local nextValue = tbl[ key ]
if nextValue == nil then
tbl[ key ] = {}
elseif gpm.type( tbl ) ~= "table" then
break
elseif gpm.type( nextValue ) ~= "table" then
return
end

tbl = tbl[ key ]
end
end

Expand Down

0 comments on commit 92615f3

Please sign in to comment.