Module:Extra Effect: Difference between revisions
Jump to navigation
Jump to search
Created page with "local p = {} local lib = require('Module:Feature') function p.main(frame) local args = require('Module:Arguments').getArgs(frame) return p._main(args) end function p._main(args) end return p" |
this is kinda a wip cause tt is still Like That |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local lib = require('Module:Feature') | local lib = require('Module:Feature') | ||
local tt = require('Module:Tt') | |||
local Data = require('Module:Extra Effect/data') | |||
function p.main(frame) | function p.main(frame) | ||
| Line 8: | Line 10: | ||
function p._main(args) | function p._main(args) | ||
local displaytext = args[1] | |||
local effect = lib.isNotEmpty(args[2]) and args[2] or displaytext | |||
local entry | |||
local effect = lib.trim(mw.ustring.lower(effect)) | |||
for k, v in pairs(Data) do | |||
if lib.trim(mw.ustring.lower(k)) == effect then | |||
entry = v | |||
break | |||
end | |||
end | |||
if not entry then | |||
local cat = '[[Category:Pages Referencing Unknown Extra Effects]]' | |||
return tostring(tt._main({ displaytext })) .. cat | |||
end | |||
local tooltiptext = entry.header .. ': ' .. entry.effect | |||
return tt._main({ displaytext, tooltiptext }) | |||
end | end | ||
return p | return p | ||
Latest revision as of 20:16, 14 July 2026
Documentation for this module may be created at Module:Extra Effect/doc
local p = {}
local lib = require('Module:Feature')
local tt = require('Module:Tt')
local Data = require('Module:Extra Effect/data')
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame)
return p._main(args)
end
function p._main(args)
local displaytext = args[1]
local effect = lib.isNotEmpty(args[2]) and args[2] or displaytext
local entry
local effect = lib.trim(mw.ustring.lower(effect))
for k, v in pairs(Data) do
if lib.trim(mw.ustring.lower(k)) == effect then
entry = v
break
end
end
if not entry then
local cat = '[[Category:Pages Referencing Unknown Extra Effects]]'
return tostring(tt._main({ displaytext })) .. cat
end
local tooltiptext = entry.header .. ': ' .. entry.effect
return tt._main({ displaytext, tooltiptext })
end
return p