Module:Sandbox/Exaskliri/GearInfo/S3: Difference between revisions

From Inkipedia, the Splatoon wiki
m (changed frame:callParserFunction format. Will this work?)
mNo edit summary
Line 14: Line 14:
for k, v in pairs(storeArgs) do
for k, v in pairs(storeArgs) do
if type(v) == "boolean" then
if type(v) == "boolean" then
storeArgs[k] = boolTextToNum[v]
storeArgs[k] = boolTextToNum(v)
end
end
end
end
storeArgs["_table"] = "Gear_S3"
storeArgs["_table"] = "Gear_S3"
frame:callParserFunction{
frame:callParserFunction("#cargo_store:", storeArgs)
name = '#cargo_store',
args = storeArgs
}
end
end



Revision as of 12:54, 24 March 2024

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("#cargo_store:", 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