diff --git a/lua/gpm/init.lua b/lua/gpm/init.lua index bec2979a..8f01f39d 100644 --- a/lua/gpm/init.lua +++ b/lua/gpm/init.lua @@ -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 ) diff --git a/lua/gpm/sources/lua.lua b/lua/gpm/sources/lua.lua index 0587fe14..0855dc26 100644 --- a/lua/gpm/sources/lua.lua +++ b/lua/gpm/sources/lua.lua @@ -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 @@ -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 ) \ No newline at end of file diff --git a/lua/gpm/utils.lua b/lua/gpm/utils.lua index 48a886e7..f6ec9e9e 100644 --- a/lua/gpm/utils.lua +++ b/lua/gpm/utils.lua @@ -193,8 +193,8 @@ 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 @@ -202,8 +202,8 @@ function table.Lookup( tbl, path, default ) 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 @@ -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