Module:Sandbox/Exaskliri/GearInfo/S3

From Inkipedia, the Splatoon wiki
< Module:Sandbox‎ | Exaskliri/GearInfo
Revision as of 12:49, 24 March 2024 by Exaskliri (talk | contribs) (changed frame:callParserFunction format. Will this work?)

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
	for k, v in pairs(storeArgs) do
		if type(v) == "boolean" then
			storeArgs[k] = boolTextToNum[v]
		end
	end
	storeArgs["_table"]		= "Gear_S3"
	
	frame:callParserFunction{
		name = '#cargo_store',
		args = storeArgs
	}
end

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

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

return p

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