Dota 2 Wiki
Register
(Moved the colors table to the /data page)
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 get_args = require('Module:Arguments').main
+
local getArgs = require('Module:Arguments').getArgs
   
   
function p.main()
+
function p.main(frame)
local args = get_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

Documentation for Module:Color Jump to code ↴ [ edit | purge ]

Reality Rift icon
▶️ 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