Module:HonorTabs

From Pathfinder Wiki
Revision as of 20:46, 27 April 2021 by DesignerThan (talk | contribs)

Documentation for this module may be created at Module:HonorTabs/doc

local p = {}

function p.hello( frame )
	return "Hello, world!"
end

function p.getLangSuffix( frame )
	return frame:expandTemplate{ title = 'GetLangSuffix' }
end

function p.createAnswerTab( frame )
	if frame.args.answerVariants then
		
		return "There are answer variants: " .. prepareAnswerVariants(frame.args.answerVariants)
	else
		return "There aren't any answer variants!"
	end
	
end

function prepareAnswerVariants(variants)
	t_variants = splitString(variants, ";;")
	result_string = ""
	for key, value in pairs(t_variants) do
		result_string = result_string .. " * " .. key .. " -- " .. value
	end
	return result_string
end

function splitString(inputstring, seperator)
	if seperator == nil then
		seperator = "%s"
	end
	local t={}
	for str in string.gmatch(inputstring, "([^"..seperator.."]+)") do
		table.insert(t, str)
	end
	return t
end


return p