Module:Sandbox/Jackmcbarn: Difference between revisions

Content deleted Content added
Jackmcbarn (talk | contribs)
rewrite
Jackmcbarn (talk | contribs)
handle false cognates
Line 33:
end
local retval = args.src[to]
if retval ~= nil or args.from[k] ~= nil then
return retval
end
Line 45:
end
local to = args.to[k]
local falseCognate = args.from[k] ~= nil
if type[(to]) == 'table' then
args.src[k] = nil
if v == nil and not falseCognate then
args.src[k] = nil
end
for k2,v2 in ipairs(to) do
if k2 == 1 then
args.src[v2] = v
elseif v == nil then
else
args.src[v2] = nil
end
end
elseif to =~= nil then
if v == nil and not falseCognate then
args.src[k] = nil
end
args.src[to] = v
elseif not falseCognate then
args.src[k] = v
else
error('Attempt to write key "' .. k .. '" which has no translation and is a false cognate', 2)
args.src[k] = nil
args.src[to] = v
end
end