# HG changeset patch # User Waqas Hussain # Date 1252709119 -18000 # Node ID de86734d3f7f80dbd22fa4c8a10d56906d1b0700 # Parent d4835b79d2cabe7339bc7c132c4cbef7c08618e5 configmanager: Assign a chunk name to config files loaded using the default config loader (fixes issues with some diagnostic tools). diff -r d4835b79d2ca -r de86734d3f7f core/configmanager.lua --- a/core/configmanager.lua Sat Sep 12 03:41:31 2009 +0500 +++ b/core/configmanager.lua Sat Sep 12 03:45:19 2009 +0500 @@ -68,7 +68,7 @@ if parsers[format] and parsers[format].load then local f, err = io.open(filename); if f then - local ok, err = parsers[format].load(f:read("*a")); + local ok, err = parsers[format].load(f:read("*a"), filename); f:close(); if ok then eventmanager.fire_event("config-reloaded", { filename = filename, format = format }); @@ -99,7 +99,7 @@ local loadstring, pcall, setmetatable = _G.loadstring, _G.pcall, _G.setmetatable; local setfenv, rawget, tostring = _G.setfenv, _G.rawget, _G.tostring; parsers.lua = {}; - function parsers.lua.load(data) + function parsers.lua.load(data, filename) local env; -- The ' = true' are needed so as not to set off __newindex when we assign the functions below env = setmetatable({ Host = true; host = true; Component = true, component = true, @@ -139,7 +139,7 @@ local f, err = io.open(file); if f then local data = f:read("*a"); - local ok, err = parsers.lua.load(data); + local ok, err = parsers.lua.load(data, file); if not ok then error(err:gsub("%[string.-%]", file), 0); end end if not f then error("Error loading included "..file..": "..err, 0); end @@ -147,7 +147,7 @@ end env.include = env.Include; - local chunk, err = loadstring(data); + local chunk, err = loadstring(data, "@"..filename); if not chunk then return nil, err;