Difference between revisions of "Module:Sandbox"

From blackwiki
Jump to navigation Jump to search
blackwiki>Where was I last night?
m (85 revisions imported)
 
(22 intermediate revisions by 15 users not shown)
Line 1: Line 1:
require('Module:No globals')
+
-- Placeholder only! Do NOT add code.
local getArgs = require('Module:Arguments').getArgs
 
local p = {}
 
 
 
local infoboxImage = require('Module:InfoboxImage').InfoboxImage
 
local lc = require('Module:WikitextLC').selective
 
 
 
function p.main(frame)
 
local args = getArgs(frame)
 
return p._main(args)
 
end
 
 
 
function p._main(args)
 
-- Main module code goes here.
 
local variety = {'', '-hans', '-hant', '-cn', '-hk', '-mo', '-sg', '-tw'}
 
local varietyHans = {'-hans', '-cn', '-sg'}
 
local varietyHant = {'-hant', '-hk', '-mo', '-tw'}
 
local hansIndicator, hantIndicator = false, false
 
 
for i, v in ipairs(varietyHans) do
 
if args['image' .. v] then
 
hansIndicator = true
 
break
 
end
 
end
 
 
 
for i, v in ipairs(varietyHant) do
 
if args['image' .. v] then
 
hantIndicator = true
 
break
 
end
 
end
 
 
 
if hansIndicator and hansIndicator then
 
local content = {}
 
for i, v in ipairs(variety) do
 
local parameter = 'image' .. v
 
local value = args[patameter]
 
if value then
 
content[parameter] = infoboxImage{args = {image = value, sizedefault = 'frameless', upright = '1.15'}}
 
end
 
end
 
return lc(content)
 
end
 
 
return infoboxImage{args = {image = args.image, sizedefault = 'frameless', upright = '1.15'}}
 
 
end
 
 
 
return p
 

Latest revision as of 09:13, 27 September 2020

Scribunto Testing Area

This is not an actual Lua module. It exists to provide a convenient pseudo-namespace for code testing, hopefully preventing the main Module: namespace from becoming littered with experiments, as Lua modules cannot exist as subpages in the User: namespace.

Please name your experimental modules in the following format to help keep things tidy:

Module:Sandbox/Your User Name/Module name

You can use Special:PrefixIndex/Module:Sandbox to list modules in this area.



-- Placeholder only! Do NOT add code.