Module:Sandbox/Sameboat/m1: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
 
(82 intermediate revisions by the same user not shown)
Line 2:
local p = {}
 
function p._linknavbar(argsframe)
local navbar = require('Module:Navbar').navbar
return navbar('asd')
end
 
p.lengthcheck = function()
local asd = '123456789'
return string.len(asd)
end
 
p.indextable = function()
local result = ''
local t={}
t[#t+1]='odin'.. 1 + 0
t[#t+1]='dva'.. '1 + 1'
t[#t+1]='tri'.. 1.5 * 2
return table.concat(t, ', ') .. '.'
end
local function makeInvokeFunction(funcName)
Line 10 ⟶ 29:
return p[funcName](args)
end
end
p.link = makeInvokeFunction('_link')
function p._link(args)
local result='{|class="wikitable"\n|-'
local t = {
{h='a', d='1a'},
{h='b', d='2b'},
{h='c', d='3c'},
{h='d', d='4d'},
}
t[5] = {h = 'e', d = '5e'}
t[6] = {h = 'f', d = '6f'}
t[7] = {h = 'g', d = '7g'}
for i,v =in 10,100,10ipairs(t) do
if i==5 then break
else
result = result .. ':\n!' .. i v.. '\n'h
end
end
result=result..'\n|-'
for i,v in ipairs(t) do
result = result .. '\n|-\n!' .. k1 .. '\n|' .v. v2d
end
result=result..'\n|-'
local t = {
{h='aa', d='1aa'},
{h='bb', d='2bb'},
{h='cc', d='3cc'},
{h='dd', d='4dd'},
}
for i,v in ipairs(t) do
result=result..'\n!'..v.h
end
result=result..'\n|-'
for i,v in ipairs(t) do
result=result..'\n|'..v.d
end
return result .. '\n|}'
end
Line 17 ⟶ 76:
local result
result = ''
localfor tmpk1, =v1 in ipairs(mw.text.split(somelist, '\n')) do
for k1k2, v1v2 in pairsipairs(tmpmw.text.split(v1 .. '\\', '\\')) do
if (k1k2 %> 2 ==then 0) thenbreak
local tmp2 = mw.text.split(v1, '\\')
for elseif (k2, v2% in2 pairs(tmp2== 1) dothen
if (k2k1 % 2 == 0) then
result = result .. '\n|-style="background:#888"\n!' .. k1 .. '\n|' .. v2
else result = result .. '\n|-\n!' .. k1 .. '\n|' .. v2
else
else end
if (k1 % 2 == 0) then
resultelseif (k2 % 2 == 0) then result .. '\n|-style="background:#888"\n!' .. k1result .. '\n||' .. v2
else
result = result .. '\n|-\n!' .. k1 .. '\n|' .. v2
end
end
end
end
result = '{|class="wikitable"\n' .. result .. '\n|}'
return result
end
p.link = makeInvokeFunction('_link')
function p._link(args)
local result
result = 'Simple loop\n'
for i = 10,100,10 do
result = result .. ':' .. i .. '\n'
end
return result
end