ARK: Survival Evolved Wiki
Advertisement
ARK: Survival Evolved Wiki

Documentation for this module may be created at Module:DLCLink/doc

-- checks if the name contains a DLC-suffix and changes it to the according DLC-icon. then returns a link to name.

local p = {}
function p.link(name, noDlcIcon)
  -- look up DLC icon info for the name with DissectDlcItemName
  local tryMatch = require('Module:DissectDlcItemName').tryMatch
  local info = tryMatch(name)
  if info then
  	return '[['..name..'|'..info.displayName..']]'.. ((not noDlcIcon) and ' [[File:'..info.dlcIcon..'|16px|link='..info.dlcArticle..'|alt=('..info.dlcArticle..')]]' or '')
  end

  -- if no dlc was found, use generic approach
  local title = mw.title.new(name)
  if title == nil then
    return 'page not found: ' .. name
  end
  local link = (#title.nsText > 0) and (title.fullText .. '|' .. title.text) or title.text
  return '[['..link..']]'
end
return p
Advertisement