Difference between revisions of "Module:Sandbox/BrandonXLF/scripts/doc"
< Module:Sandbox | BrandonXLF | scripts
Jump to navigation
Jump to search
blackwiki>BrandonXLF |
blackwiki>BrandonXLF (Removed bracket) |
||
| Line 5: | Line 5: | ||
local args = getArgs(frame) | local args = getArgs(frame) | ||
local i = 1 | local i = 1 | ||
| − | local out = '<h2>Variables</h2>Optionally, add any of the <code>code snippets</code> below to the JS file you installed the script in (eg. your [[Special:MyPage/common.js|common.js]] file) to change the settings for this script. For best compatibility, put them above the code that is used to load the script | + | local out = '<h2>Variables</h2>Optionally, add any of the <code>code snippets</code> below to the JS file you installed the script in (eg. your [[Special:MyPage/common.js|common.js]] file) to change the settings for this script. For best compatibility, put them above the code that is used to load the script.<ul>' |
args['v1'] = (args['v'] or args['v1']) | args['v1'] = (args['v'] or args['v1']) | ||
args['d1'] = (args['d'] or args['d1']) | args['d1'] = (args['d'] or args['d1']) | ||
Revision as of 22:29, 25 August 2020
Used in User:BrandonXLF/scripts/doc
local getArgs = require('Module:Arguments').getArgs
local p = {}
function p.variables (frame)
local args = getArgs(frame)
local i = 1
local out = '<h2>Variables</h2>Optionally, add any of the <code>code snippets</code> below to the JS file you installed the script in (eg. your [[Special:MyPage/common.js|common.js]] file) to change the settings for this script. For best compatibility, put them above the code that is used to load the script.<ul>'
args['v1'] = (args['v'] or args['v1'])
args['d1'] = (args['d'] or args['d1'])
args['e1'] = (args['e'] or args['e1'])
while args['v'..i] do
local var = '<code>window.'..args['v'..i]..' ='..(args['e'..i] and ' '..args['e'..i] or '')..';</code>'
var = var..(args['d'..i] and ' – '..args['d'..i] or '')
out = out..'<li>'..var..'</li>'
i = i + 1
end
return out..'</ul>'
end
return p