gluon-core: make Lua files proper modules
This commit is contained in:
parent
bf7a2c974e
commit
ee307ec1de
@ -6,4 +6,16 @@ local function loader()
|
||||
end
|
||||
|
||||
-- setfenv doesn't work with Lua 5.2 anymore, but we're using 5.1
|
||||
return setfenv(assert(load(coroutine.wrap(loader), 'site.conf')), {})()
|
||||
local site_config = setfenv(assert(load(coroutine.wrap(loader), 'site.conf')), {})()
|
||||
|
||||
local setmetatable = setmetatable
|
||||
|
||||
module 'gluon.site_config'
|
||||
|
||||
setmetatable(_M,
|
||||
{
|
||||
__index = site_config,
|
||||
}
|
||||
)
|
||||
|
||||
return _M
|
||||
|
@ -17,11 +17,15 @@ local function set(_, name, val)
|
||||
f:close()
|
||||
end
|
||||
|
||||
local sysconfig = {}
|
||||
local mt = {
|
||||
local setmetatable = setmetatable
|
||||
|
||||
module 'gluon.sysconfig'
|
||||
|
||||
setmetatable(_M,
|
||||
{
|
||||
__index = get,
|
||||
__newindex = set,
|
||||
}
|
||||
)
|
||||
|
||||
setmetatable(sysconfig, mt)
|
||||
return sysconfig
|
||||
return _M
|
||||
|
Loading…
Reference in New Issue
Block a user