diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-08-23 22:10:36 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-08-23 22:10:36 +0100 |
commit | 026b1a34f5259c7cb907c4954bd3d27c9a3a961d (patch) | |
tree | 6a29f0c3025f5f78b24b6bb6c113ca167b23bf48 | |
parent | 142d1bc7549f04c29d4ca78ee5f796562a533435 (diff) | |
download | clod-026b1a34f5259c7cb907c4954bd3d27c9a3a961d.tar.gz |
CLOD: Ensure we can't set functions or tables as clod entries
-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 } |