Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:For nowiki/sandbox
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} local function doLoop(frame, args, code, sep, offset, argstosub) local result = {} code = mw.text.unstripNoWiki(code) for i, value in ipairs(args) do if i > offset then argstosub["i"] = i - offset argstosub["1"] = value local actualCode = code:gsub("{{{([^{}|]*)|?[^{}]*}}}", argstosub) table.insert(result, frame:preprocess(actualCode)) end end return table.concat(result, sep) end function p.main(frame) local args = frame:getParent().args local sep = args[1] local code = args.code or args[2] local offset = args.code and 1 or 2 local argstosub = {} for key, value in pairs(args) do if not tonumber(key) and key ~= "i" and key ~= "count" then argstosub[key] = value end end local countArg = args.count and tonumber(args.count); if countArg then offset = 0 args = {} for i = 1, countArg do args[i] = i end end return doLoop(frame, args, code, sep, offset, argstosub) end function p.template(frame) local sep = frame.args[1] local code = frame.args[2] or frame.args.code local forceone = frame.args[3] local offset = tonumber(frame.args.offset) or 0 local pargs = frame:getParent().args if forceone and not pargs[1] then pargs[1] = 'test' end return doLoop(frame:getParent(), pargs, code, sep, offset, {}) end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:For nowiki/sandbox/doc
(
edit
)