Module:Sond-roots

From Allocosm
Revision as of 09:40, 17 March 2024 by Vaxjedi (talk | contribs) (Created page with "export = {} require("Module:sond-roots/data") function export.replace(str1, str2, oper) local rules = {} local output = "" local orig_oper = opers[oper] local orig_rules = orig_oper[1] local default = orig_oper[2] for k,v in pairs(orig_rules) do rules[k] = string.gsub(v,"[12]",{["1"] = str1, ["2"] = str2}) end default = string.gsub(default,"[12]",{["1"] = str1, ["2"] = str2}) output = rules[str1..str2] or default return output end return ex...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Sond-roots/doc

export = {}

require("Module:sond-roots/data")

function export.replace(str1, str2, oper) 
	
	local rules = {}
	local output = ""
	local orig_oper = opers[oper]
	local orig_rules = orig_oper[1]
	local default = orig_oper[2]

	for k,v in pairs(orig_rules) do
		rules[k] = string.gsub(v,"[12]",{["1"] = str1, ["2"] = str2})
	end
	default = string.gsub(default,"[12]",{["1"] = str1, ["2"] = str2})

	output = rules[str1..str2] or default

	return output

end










return export