webmcp
changeset 233:827c44692141
Allow setting certain global variables in autoloader
author | jbe |
---|---|
date | Sat Feb 28 23:28:41 2015 +0100 (2015-02-28) |
parents | 82cc171e8510 |
children | 36346c33a020 |
files | framework/bin/mcp.lua |
line diff
1.1 --- a/framework/bin/mcp.lua Sat Feb 28 23:11:40 2015 +0100 1.2 +++ b/framework/bin/mcp.lua Sat Feb 28 23:28:41 2015 +0100 1.3 @@ -162,12 +162,21 @@ 1.4 return false 1.5 end 1.6 end 1.7 + if self == _ENV then 1.8 + _G[key] = false -- allow writing global variable 1.9 + end 1.10 if merge and try_exec(merge_path .. ".lua") then 1.11 elseif merge and try_dir(merge_path .. "/") then 1.12 elseif try_exec(path .. ".lua") then 1.13 elseif try_dir(path .. "/") then 1.14 else end 1.15 - return rawget(self, key) 1.16 + local value = rawget(self, key) 1.17 + if self == _ENV and value == false then 1.18 + _G[key] = nil 1.19 + return nil 1.20 + else 1.21 + return value 1.22 + end 1.23 end 1.24 install_autoloader(_G, nil, "") 1.25 try_exec(WEBMCP_FRAMEWORK_PATH .. "env/__init.lua")