Module:Sandbox/Jackmcbarn: Difference between revisions

Content deleted Content added
Jackmcbarn (talk | contribs)
basic tests
Jackmcbarn (talk | contribs)
rm tables
Line 28:
args.from = {}
for k,v in pairs(args.to) do
if type(args.from[v)] == 'table' thenk
for _,v2 in ipairs(v) do
args.from[v2] = k
end
else
args.from[v] = k
end
end
end
Line 41 ⟶ 35:
function mt.__index(t, k)
if type(k) == 'string' then
local toretval = args.src[args.to[k]]
if type(to) == 'table' then
for _,v in ipairs(to) do
local retval = args.src[v]
if retval ~= nil then
return retval
end
end
end
local retval = args.src[to]
if retval ~= nil or args.from[k] ~= nil then
return retval
Line 64 ⟶ 49:
local to = args.to[k]
local falseCognate = args.from[k] ~= nil
if type(to) =~= 'table'nil then
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
args.src[v2] = nil
end
end
elseif to ~= nil then
if v == nil and not falseCognate then
args.src[k] = nil
Line 99 ⟶ 73:
function p.main(frame)
local args = {
uno = '#FF0000',
eins = '#ff0000',
dos = '#FF8000',
zwei = '#ff7f00',
tres = '#ffff00',
drei = '#FFFF00',
three = 'yellow'
}
local to = {
one = 'unoeins',
two = { 'dos', 'zwei' },
three = 'drei'
}