# HG changeset patch # User Matthew Wild # Date 1256524570 0 # Node ID a4f608729bbf874704e7599ba6e495db51c350e0 # Parent 842f3003db2ab2a24785d10b0028eb43a5f03aee Whitespace and various fixes, return _M diff -r 842f3003db2a -r a4f608729bbf luatraverse.lua --- a/luatraverse.lua Mon Oct 26 02:34:45 2009 +0000 +++ b/luatraverse.lua Mon Oct 26 02:36:10 2009 +0000 @@ -74,6 +74,7 @@ -- inserts the local variables -- interates over the function on the stack, starting from the one that -- called traverse + for i=2, math.huge do local info = debug.getinfo(i, "f") if not info then break end @@ -86,8 +87,8 @@ end end - while not List.isempty(env.list) do - + while not List.isempty(env.list) do + local obj = List.pop(env.list) local t = type(obj) traverse["traverse" .. t](env, obj) @@ -103,7 +104,7 @@ for key, value in pairs(obj) do edge(env, obj, key, "iskey", nil) - edge(env, obj, value, "key", key) + edge(env, obj, value, "key", key) end local mtable = debug.getmetatable(obj) @@ -172,7 +173,7 @@ -- 'how' is a string that identifies the content of 'to' and 'value': --- if 'how' is "iskey", then 'to' é is a key and 'value' is nil. +-- if 'how' is "iskey", then 'to' é is a key and 'value' is nil. -- if 'how' is "key", then 'to' is an object and 'value' is the name of the -- key. function edge(env, from, to, how, value) @@ -190,5 +191,6 @@ if f then f(from, to, how, value) end end - -end \ No newline at end of file +end + +return _M;