@DeletedUser41170185 (talk | contribs) (Moved the colors table to the /data page) |
@DeletedUser41170185 (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
local p = {} |
local p = {} |
||
local colors = mw.loadData('Module:Color/data') |
local colors = mw.loadData('Module:Color/data') |
||
− | local |
+ | local getArgs = require('Module:Arguments').getArgs |
− | function p.main() |
+ | function p.main(frame) |
− | local args = |
+ | local args = getArgs(frame, { |
+ | wrappers = { |
||
+ | 'Template:Color' |
||
+ | } |
||
+ | }) |
||
local success, result = pcall(p._main, args) |
local success, result = pcall(p._main, args) |
Latest revision as of 12:49, 20 April 2018
▶️
Planeshift.
The documentation for this module can be found at Template:Color.
You may be forwarded to another wiki language, in case a translation is not available.
Dependencies
local p = {}
local colors = mw.loadData('Module:Color/data')
local getArgs = require('Module:Arguments').getArgs
function p.main(frame)
local args = getArgs(frame, {
wrappers = {
'Template:Color'
}
})
local success, result = pcall(p._main, args)
if success then
return mw.text.nowiki(result)
else
-- Returning an empty string to prevent old templates from breaking.
-- TODO: Update all templates.
return ''
end
end
function p._main(args)
assert(args[1], 'Missing input')
return colors[args[1]:lower()] or args[1]
end
return p