Commit 89247e0e authored by Jaromil's avatar Jaromil
Browse files

zencode dictionary statements to move from dict to dict

parent 98af03bd
......@@ -246,6 +246,32 @@ When("create the copy of object named by '' from dictionary ''", function(name,
create_copy_f(dict, label:string())
When("move '' out of ''", function(name, dict)
local saved_copy
-- temporary save for copy objects since we reuse create_copy_f
if ACK.copy then
saved_copy = ACK.copy
ACK.copy = nil
create_copy_f(dict, name)
ACK[name] = ACK.copy
ACK.copy = nil
ZEN.CODEC[name] = ZEN.CODEC.copy
ZEN.CODEC.copy = nil
-- restore any saved 'copy' object
if saved_copy then ACK.copy = saved_copy end
When("move '' from '' to ''", function(name, src, dst)
local dest = have(dst)
local source = have(src)
ZEN.assert(not dest[name], "Cannot overwrite '""' in '"..dst.."'")
ZEN.assert(source[name], "Member not found: '""' in '"..src.."'")
ACK[dst][name] = source[name]
ACK[src][name] = nil
When("for each dictionary in '' append '' to ''", function(arr, right, left)
local dicts = have(arr)
ZEN.assert(luatype(dicts) == 'table', 'Object is not a table: '..arr)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment