10,731
edits
TheNightAvl (talk | contribs) No edit summary |
TheNightAvl (talk | contribs) No edit summary |
||
Line 53: | Line 53: | ||
end | end | ||
function export. | 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 | ||