Blinding Light icon.png
Eh, what was I doing?
Search is currently offline.
This is due to the ongoing MediaWiki 1.33 update. Search is being re-indexed as we are upgrading to Elasticsearch 6.

Module:Placement

From Dota 2 Wiki
Jump to: navigation, search

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

Reality Rift icon.png
▶️ Planeshift.
The documentation for this module can be found at Template:Placement.
You may be forwarded to another wiki language, in case a translation is not available.


Dependencies

local p = {}
local data = mw.loadData('Module:Placement/data')
local getArgs = require('Module:Arguments').getArgs


function p.main(frame)
  local args = getArgs(frame, {
    wrappers = {
      'Template:Placement'
    }
  })
  return p._main(args)
end

function p._main(args)
  if args[1] then
    local entry = data[string.lower(args[1])]
  
    if entry then
      local text_color = entry[4] or 'white'
      local text = mw.html.create('span')
        :css('color', text_color)
        :css('font-weight', 'bold')
        :wikitext(entry[3])
    
      return 'bgcolor="' .. entry[1] .. '" align=center | <span style="display:none;">' .. entry[2] .. '</span>' .. tostring(text)
    else
      error('No data found in Module:Placement', 0)
    end
  else
    error('Check your input', 0)
  end
end


return p