Module:kilta-headword: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 19: Line 19:
local function plural(word, n)
local function plural(word, n)
local w = split(word, "%s")
local w = split(word, "%s")
if tonumber(n) > tonumber(#w) then error("Word index outside bounds.") end
if tonumber(n) > #w then error("Word index outside bounds.") end
if w[n]:match("[kh]wa$") or w[n]:match("a$") then
if w[n]:match("[kh]wa$") or w[n]:match("a$") then
Line 29: Line 29:
end
end
return {label = "plural", table.concat({n}, " ")}
return {label = "plural", table.concat(w[n], " ")}
end
end