core/configmanager.lua
changeset 13393 47d0d80da208
parent 13392 de6c1a170871
child 13394 905a6009f60d
equal deleted inserted replaced
13392:de6c1a170871 13393:47d0d80da208
   127 			Include = true, include = true, RunScript = true }, {
   127 			Include = true, include = true, RunScript = true }, {
   128 				__index = function (_, k)
   128 				__index = function (_, k)
   129 					if k:match("^ENV_") then
   129 					if k:match("^ENV_") then
   130 						return os.getenv(k:sub(5));
   130 						return os.getenv(k:sub(5));
   131 					end
   131 					end
       
   132 					if k == "Lua" then
       
   133 						return _G;
       
   134 					end
   132 					local val = rawget_option(config_table, env.__currenthost or "*", k);
   135 					local val = rawget_option(config_table, env.__currenthost or "*", k);
       
   136 
   133 					if val ~= nil then
   137 					if val ~= nil then
   134 						return val;
   138 						return val;
   135 					end
   139 					end
   136 					return rawget(_G, k);
   140 
       
   141 					local g_val = rawget(_G, k);
       
   142 
       
   143 					if g_val ~= nil then
       
   144 						t_insert(warnings, ("%s:%d: direct usage of the Lua API is deprecated - replace `%s` with `Lua.%s`"):format(config_file, get_line_number(config_file), k, k));
       
   145 					end
       
   146 
       
   147 					return g_val;
   137 				end,
   148 				end,
   138 				__newindex = function (_, k, v)
   149 				__newindex = function (_, k, v)
   139 					local host = env.__currenthost or "*";
   150 					local host = env.__currenthost or "*";
   140 					local option_path = host.."/"..k;
   151 					local option_path = host.."/"..k;
   141 					if set_options[option_path] then
   152 					if set_options[option_path] then