diff options
-rw-r--r-- | lib/clod.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/clod.lua b/lib/clod.lua index 54c83d4..3e70ca2 100644 --- a/lib/clod.lua +++ b/lib/clod.lua @@ -76,6 +76,9 @@ function settings_mt:__newindex(subkey, value) local meta = metadata[self] local confmeta = metadata[meta.conf] local key = subkey + if type(value) == "table" or type(value) == "function" then + error("Clod does not support " .. type(value) .. "s as values") + end if meta.prefix then key = meta.prefix .. "." .. subkey end @@ -234,9 +237,15 @@ local function parse_config(conf, confname) end function parse_mt:__newindex(key, value) -- This is the equivalent of 'foo = "bar"' instead of 'foo "bar"' + if type(value) == "table" or type(value) == "function" then + error("Clod does not support " .. type(value) .. "s as values") + end return self[key](value) end function parse_mt:__call(value) + if type(value) == "table" or type(value) == "function" then + error("Clod does not support " .. type(value) .. "s as values") + end local key = assert(keys[self]) local curline = getinfo(2, "Snlf").currentline local entry = { key = key, value = value, lineno = curline } |