summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2015-02-03 22:28:09 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2015-02-03 22:28:09 +0000
commit88cd841fb0ec8901360cbde5384ed49207033774 (patch)
treee950d1e1cbd38386713929100c32b9e63f9ea99a
parent2bb0ee976907a3d925a524841b00879c1f2d05e0 (diff)
downloadclod-88cd841fb0ec8901360cbde5384ed49207033774.tar.gz
Update clod to support 5.2 as well as 5.1
-rw-r--r--lib/clod.lua16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/clod.lua b/lib/clod.lua
index d9b4fde..952796c 100644
--- a/lib/clod.lua
+++ b/lib/clod.lua
@@ -358,12 +358,18 @@ local function parse_config(conf, confname, migrate_lists)
last_entry = entry
settings[key] = entry
end
- local func, msg = loadstring(conf, ("@%s"):format(confname or "clod-config"))
- if not func then
- return nil, msg
- end
+ local func, msg
+ local sourcename = ("@%s"):format(confname or "clod-config")
local globs = setmetatable({}, parse_mt)
- setfenv(func, globs)
+ if setfenv == nil then
+ func, msg = load(conf, sourcename, "t", globs)
+ else
+ func, msg = loadstring(conf, sourcename)
+ if not func then
+ return nil, msg
+ end
+ setfenv(func, globs)
+ end
local ok, err = pcall(func)
if not ok then
return nil, err