Difference between revisions of "Module:HonorTabs"

From Pathfinder Wiki
Line 16: Line 16:
 
end
 
end
 
 
 +
end
 +
 +
function prepareAnswerVariants(variants)
 +
t_variants = splitString(variants, ";;")
 +
for key, value in pairs(t_variants) do
 +
print("*", key, "--", value)
 +
end
 +
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
 
end
  
  
 
return p
 
return p

Revision as of 20:41, 27 April 2021

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: " .. frame.args.answerVariants
	else
		return "There aren't any answer variants!"
	end
	
end

function prepareAnswerVariants(variants)
	t_variants = splitString(variants, ";;")
	for key, value in pairs(t_variants) do
		print("*", key, "--", value)
	end
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