模块:Color

来自Dota 2 Wiki
跳转至: 导航搜索
Reality Rift icon.png
▶️ Planeshift.
该模块的文档可以在Template:Color找到。
You may be forwarded to another wiki language, in case a translation is not available.



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], '缺少输入')
  return colors[args[1]:lower()] or args[1]
end


return p