Module:Sandbox/Aurelain/Link
From Heroes of Might and Magic: Olden Era Official Wiki
This module is intended as a supporting muscle for the LinkIcon template.
clean()
Removes the following words from a text:
BasicAdvancedExpert_specialMasterful
Afterwords, appends a language code, if provided and necessary.
Input:
{{#invoke:Sandbox/Aurelain/Link|clean
|Lorem,Basic ,Advanced ,Expert ,_special,Masterful ,Ipsum
}}
Output: Lua error at line 13: attempt to call method 'replace' (a nil value).
-- Usage: see Module:Link/doc
local p = {}
-- Displays a variable
------------------------------------------------------------------------------------------------------------------------
local function dump(target)
return '<pre>' .. mw.dumpObject(target) .. '</pre>'
end
------------------------------------------------------------------------------------------------------------------------
function p.clean(frame)
local text = frame.args[1]
text = text:replace('Basic ', '')
text = text:replace('Advanced ', '')
text = text:replace('Expert ', '')
text = text:replace('_special', '')
text = text:replace('Masterful ', '')
return text
end
return p


