diff options
author | koray kavukcuoglu <koray@kavukcuoglu.org> | 2016-01-29 14:41:17 +0300 |
---|---|---|
committer | koray kavukcuoglu <koray@kavukcuoglu.org> | 2016-01-29 14:41:17 +0300 |
commit | 52ba96bc4c3886170c81dc404fa6335566bfa73d (patch) | |
tree | 96a22e587ba6ad2800e00b61c39e61c871e45a2d | |
parent | b43cc8247fc789fed63f86e5aaa91582f1e15450 (diff) | |
parent | 1c5742fef67edf3ce20eb2e0cae9f1abee5e3ce4 (diff) |
Merge pull request #99 from malcolmreynolds/safer_copynested
Safer copynested
-rw-r--r-- | nesting.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/nesting.lua b/nesting.lua index e1ddd7b..4440797 100644 --- a/nesting.lua +++ b/nesting.lua @@ -59,10 +59,11 @@ function nesting.copyNested(output, input) for key, child in pairs(input) do nesting.copyNested(output[key], child) end - -- Extra elements are removed from the output. + -- Extra elements in the output table cause an error. for key, child in pairs(output) do if not input[key] then - output[key] = nil + error('key ' .. tostring(key) .. + ' present in output but not in input') end end end |