Module:User:Njardarlogar
- This module sandbox lacks a documentation subpage. You may create it.
- Useful links: subpage list • links • transclusions • testcases • user page • user talk page • userspace
This is a private module sandbox of Njardarlogar, for their own experimentation. Items in this module may be added and removed at Njardarlogar's discretion; do not rely on this module's stability.
local p = {}
function p.returnValue()
res1 = 'value' or false
res2 = false or 'value'
return res1 .. ' ' .. res2
end
function p.returnMultiple()
res = {'Part 1', 'Part 2'}
return {res[1], res[2]}
end
function p.useMultiple()
gottenRes = p.returnMultiple()
return gottenRes[1]
end
function p.isAYear(frame)
arg = frame.args[1]
if arg:find('^%-*%d+$') then
return "'''" .. arg .. "'''" .. ' a year'
else
return "'''" .. arg .. "'''" .. ' not a year'
end
end
function p.isNorDate(frame)
arg = frame.args[1]
if arg:find('^%d%d%.$') or arg:find('^%d%.$') then
return "'''" .. arg .. "'''" .. ' is NorDate'
else
return "'''" .. arg .. "'''" .. ' is not NorDate'
end
end
function p.isIn(frame)
list = {'1', '2', 'l'}
arg1 = frame.args[1]
for n, ele in ipairs(list) do
if ele == arg1 then
return 'yes'
end
end
return 'no'
end
function p.isIn2(frame)
list = {}
list['1'] = true
list['2'] = true
list['l'] = true
arg1 = frame.args[1]
return list[arg1]
end
function p.iterator(frame)
res = ''
for i, x in ipairs({'2', '3', 's'}) do
res = res .. x
end
return res
end
function p.splitter(frame)
f = mw.text.split('n-gasdasd', '-')
return 'works'
end
function p.arg(frame)
page = frame:preprocess('{{PAGENAME}}')
arg1 = frame.args[1]
return arg1
end
function p.search(frame)
page = frame:preprocess('{{PAGENAME}}')
text = 'boat1 boat2'
c, d = text:find('boat[12]')
return text:sub(c,d)
end
function p.printTable(frame)
a = {'a', 'b'}
a.c = 'c'
for i, line in ipairs(a) do
mw.log(line)
end
return 'done'
end
return p