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
 
(4 intermediate revisions 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/Draft')
local tt = require('Module:Tt')
local Data = require('Module:Extra Effect/data')
local Data = require('Module:Extra Effect/data')


Line 11: Line 11:
function p._main(args, frame)
function p._main(args, frame)
local displaytext = args[1]
local displaytext = args[1]
local effect = lib.isNotEmpty(args[2]) and args[2] or displaytext
local effect = lib.isNotEmpty(args[2]) and args[2] or displaytext -- refers to the name of the effect
local entry
local entry
Line 25: Line 25:
if not entry then
if not entry then
local cat = '[[Category:Pages Referencing Unknown Extra Effects]]'
local cat = '[[Category:Pages Referencing Unknown Extra Effects]]'
return tostring(tt._main({ displaytext })) .. cat
return tostring(tt._main({ displaytext }, nil, frame)) .. cat
end
end



Latest revision as of 14:56, 16 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, frame)
end

function p._main(args, frame)
	local displaytext = args[1]
	local effect = lib.isNotEmpty(args[2]) and args[2] or displaytext -- refers to the name of the effect
	
	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 }, nil, frame)) .. cat
	end

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

return p