Module:Sandbox/Exaskliri/GearInfo/S3

From Inkipedia, the Splatoon wiki
< Module:Sandbox‎ | Exaskliri/GearInfo
Revision as of 12:38, 24 March 2024 by Exaskliri (talk | contribs) (Moved #cargo_store call to be returned at allText. Let's see if this works.)

Documentation for this module may be created at Module:Sandbox/Exaskliri/GearInfo/S3/doc

local p = {}
local cargo = mw.ext.cargo

function boolTextToNum(a)
	if string.lower(a) == "true" then
		return 1
	elseif string.lower(a) == "false" then
		return 0
	end
end

function cargoStore(frame)
	local storeArgs = frame:getParent().args
	storeArgs["_table"]		= "Gear_S3"
	storeArgs["adjustable"]	= boolTextToNum(storeArgs["adjustable"])
	storeArgs["sandbox"]	= boolTextToNum(storeArgs["sandbox"])

	return frame:callParserFunction("#cargo_store:", storeArgs)
end

function p.invokeFromTemplate(frame)
	return p.text(frame)
end

function p.text(frame)
	local allText = {}
	table.insert(allText, cargoStore(frame))
	table.insert(allText, string.format("* The %s's brand is [[%s]].", frame:getParent().args.name, frame:getParent().args.brand))
	return table.concat(allText, "\n")
end

return p

--Thanks for simplifying #cargo_store callParserFunction for User:Exaskliri.
--https://pillarsofeternity.fandom.com/wiki/Module:Lootlist?action=edit&oldid=181089