10,731
edits
TheNightAvl (talk | contribs) No edit summary |
TheNightAvl (talk | contribs) No edit summary |
||
Line 39: | Line 39: | ||
end | end | ||
function export. | function export.get_common_ancestors(a, b) | ||
if a.lineage == nil or b.lineage == nil then return {} end | |||
local commons = {} | |||
for ancestor, _ in pairs(a.lineage) do | for ancestor, _ in pairs(a.lineage) do | ||
if b.lineage[ancestor] then | |||
if b.lineage[ancestor] then | table.insert(commons, ancestor) | ||
end | |||
end | end | ||
return commons | |||
end | |||
function export.age_at_split(a, b) | |||
return #export.get_common_ancestors(a, b) | |||
end | end | ||