Module:XCX enum enhance

local enhance_table = mw.loadData("Module:XCX enum enhance/data") local enhance_ms_table = mw.loadData("Module:XCX enum enhance/captions")

local xcx_enum_enhance = {}

function xcx_enum_enhance.formatEnhance(e) caption = enhance_ms_table[e[10]] -- this gsub format lets us do a single operation rather than "three but we usually only need one" caption = caption:gsub("<>",{["< >"]=e[3],["< >"]=e[6],["< >"]=e[7]}) return caption end

function xcx_enum_enhance.getEnhance(frame) id = tonumber(frame.args[1]) enhanceEntry = enhance_table[id] if enhanceEntry then return frame:preprocess(xcx_enum_enhance.formatEnhance(enhanceEntry)) else return "undefinedEnhance["..id.."]" end end

return xcx_enum_enhance