Feed The Beast Wiki

Follow the Feed The Beast Wiki on Discord or Mastodon!

READ MORE

Feed The Beast Wiki
Register
Advertisement

Exports

The below four functions accept a frame containing their arguments as well as the arguments directly, so they can be used with #invoke.

link(string)

Generate a link to the given mod (named by unlocalized name or abbreviation).

link(string,string)

Generate a link to the given mod (named by unlocalized name or abbreviation). Use the second argument as the link text.

getAbbrv(string)

Given an unlocalized name or abbreviation, return the abbreviation.

getName(string)

Given an unlocalized name or abbreviation, return the localized name.

Data format

The top of this module defines the list of mods, in the form of a table. Keys are mod abbreviations, while values are a list of strings, {link, name, localizedName}

keyvalue
linkRequired name of the mod's page.
nameOptional unlocalized name of the mod if it isn't the same as the name of its page.
localizedNameRequired localized name of the mod.

local util = require('Module:Utility_functions')

local success, mods = util.requireDataLocalized('Module:Mods/list')

local function getData(name)
    return mods.byAbbrv[name] or mods.byName[name] or {}
end

local function getLink(abbr, text)
    local mod = getData(abbr)
    return '[['.. ( mod.link or abbr ) .. util.pageSuffix() .. '|' .. ( text or mod.localized or abbr ) .. ']]'
end

local function getAbbrv(name)
   return getData(name).abbr or name
end

local function getName(name)
   return getData(name).localized or name
end

local function getNameUntranslated(name)
   return getData(name).name or name
end

return {
    
    getData = util.wrapForInvoke(getData),
    getLink = util.wrapForInvoke(getLink),
    getAbbrv = util.wrapForInvoke(getAbbrv),
    getName = util.wrapForInvoke(getName),
    getNameUntranslated = util.wrapForInvoke(getNameUntranslated)
}
Advertisement