Module:Extra Effect: Difference between revisions

From Honkai: Nexus Anima Wiki
Jump to navigation Jump to search
Kuhlau (talk | contribs)
No edit summary
Kuhlau (talk | contribs)
No edit summary
(3 intermediate revisions by the same user not shown)
Line 18: Line 18:
if lib.trim(mw.ustring.lower(k)) == effect then
if lib.trim(mw.ustring.lower(k)) == effect then
entry = v
entry = v
header = k
break
break
end
end
Line 26: Line 27:
return tostring(tt._main({ displaytext })) .. cat
return tostring(tt._main({ displaytext })) .. cat
end
end
local tooltiptext = (lib.isNotEmpty(entry.header) and entry.header .. ': ' or '') .. entry.effect


return tt._main({ displaytext, tooltiptext })
return tt._main({ displaytext, entry.effect, header = header, class = "hnaw-ee" })
end
end


return p
return p

Revision as of 20:32, 15 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/Draft')
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
			header = k
			break
		end
	end
 
	if not entry then
		local cat = '[[Category:Pages Referencing Unknown Extra Effects]]'
		return tostring(tt._main({ displaytext })) .. cat
	end

	return tt._main({ displaytext, entry.effect, header = header, class = "hnaw-ee" })
end

return p