# HG changeset patch # User Matthew Wild # Date 1256524317 0 # Node ID 251fd96e1c34598715833ef967e2a5a4b37d43ea # Parent 03616849397229c56523aa5ae1077a2dacc89f6a Remove findallpaths() diff -r 036168493972 -r 251fd96e1c34 luatraverse.lua --- a/luatraverse.lua Mon Oct 26 02:29:45 2009 +0000 +++ b/luatraverse.lua Mon Oct 26 02:31:57 2009 +0000 @@ -46,36 +46,6 @@ return count end --- Prints all paths to an object -function findallpaths(obj) - - local comefrom = {} - local f = function(from, to, how, value) - if not comefrom[to] then comefrom[to] = {} end - table.insert(comefrom[to], 1, {f = from, h = how, v=value}) - end - - traverse({edge=f}, {comefrom, f}) - - - local function printpath(to) - if not to or comefrom[to].visited or to == _G then - print("-----") - return - end - comefrom[to].visited = true - for i=1, #comefrom[to] do - local tfrom = comefrom[to][i].f - print("from: ", tfrom, "\nhow:", comefrom[to][i].h, - "\nvalue:", comefrom[to][i].v) - printpath(tfrom) - end - end - - printpath(obj) - -end - -- Main function -- 'funcs' is a table that contains a funcation for every lua type and also the -- function edge edge (traverseedge).