Module:languages: Difference between revisions

Jump to navigation Jump to search
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 39: Line 39:
end
end


function export.distance(a, b)
function export.get_common_ancestors(a, b)
local i = 0
if a.lineage == nil or b.lineage == nil then return {} end
local count = 0
if a.lineage == nil or b.lineage == nil then return nil end
local commons = {}
for ancestor, _ in pairs(a.lineage) do
for ancestor, _ in pairs(a.lineage) do
count = count + 1
if b.lineage[ancestor] then
if b.lineage[ancestor] then i = i + 1 end
table.insert(commons, ancestor)
end
end
end
if i > 0 then return count - i else return nil end
return commons
end
 
function export.age_at_split(a, b)
return #export.get_common_ancestors(a, b)
end
end


Navigation menu