Module:Test

From Allocosm
Revision as of 02:34, 11 February 2024 by Vaxjedi (talk | contribs) (Created page with " require('Module:Test/data') export = {} function export.get_forms(head,vowel,tail_str) -- if root_str == nil then -- error("Root is required") -- end local forms = {} local tail = {} local patterns = {} -- root_str = string.gsub(root_str,"-","") -- local root = m_cu.parse_root(root_str,true) tail = mw.text.split(tail_str,"-") if #tail == 1 then patterns = NOMOD_PATTERNS elseif #tail == 2 then patterns = ONEMOD_PATTERNS elseif #tail == 3 then p...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

require('Module:Test/data')

export = {}

function export.get_forms(head,vowel,tail_str)

--	if root_str == nil then
--		error("Root is required")
--	end
	
	local forms = {}
	local tail = {}
	local patterns = {}
	
--	root_str = string.gsub(root_str,"-","")

--	local root = m_cu.parse_root(root_str,true)
	
	tail =  mw.text.split(tail_str,"-")
	
	if #tail == 1 then
		patterns = NOMOD_PATTERNS
	elseif #tail == 2 then
		patterns = ONEMOD_PATTERNS
	elseif #tail == 3 then
		patterns = TWOMOD_PATTERNS
	end
	
	for k,v in pairs(NOMOD_PATTERNS) do
		forms[k] = string.gsub(v,"C",head)
		forms[k] = string.gsub(forms[k],"V",vowel)
		forms[k] = string.gsub(forms[k],"1",tail[1])
		forms[k] = string.gsub(forms[k],"2",tail[2])
		forms[k] = string.gsub(forms[k],"3",tail[3])
	end

	mw.logObject(forms)
	return forms
end

return export