Module:languages: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 53: Line 53:
end
end


function export.age_at_split(a, b)
function export.stage_at_split(a, b)
return #export.get_common_ancestors(a, b)
return #export.get_common_ancestors(a, b)
end -- returns stage at which the two languages duverged as an integer; if not related, returns 0
function export.common_ancestor(a, b)
local ancestors = export.get_common_ancestors(a, b)
table.sort(ancestors, function(a, b)
local al = export.get_by_code(a).lineage or {}
local bl = export.get_by_code(b).lineage or {}
return #al > #bl
end
)
return ancestors[1]
end
end