plugin: Migrate 'merge' utility into Dictionary module

This commit is contained in:
Lucien Greathouse
2019-01-04 10:59:47 -08:00
parent 5816bb64dc
commit 1582d8f504
3 changed files with 43 additions and 43 deletions

33
plugin/src/Dictionary.lua Normal file
View File

@@ -0,0 +1,33 @@
--[[
This is a placeholder module waiting for Cryo to become available.
]]
local None = newproxy(true)
getmetatable(None).__tostring = function()
return "None"
end
local function merge(...)
local output = {}
for i = 1, select("#", ...) do
local source = select(i, ...)
if source ~= nil then
for key, value in pairs(source) do
if value == None then
output[key] = nil
else
output[key] = value
end
end
end
end
return output
end
return {
None = None,
merge = merge,
}