tests/fail/demo_globals.lua

Wed, 24 Nov 2010 02:52:37 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 24 Nov 2010 02:52:37 +0000
changeset 138
f9bb0e212d28
parent 57
3e148db7f933
permissions
-rw-r--r--

Replace error reporting code with calls to LVM.traceback()

57
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 -- globals.lua
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2 -- show all global variables
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4 local seen={}
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6 function dump(t,i)
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7 seen[t]=true
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 local s={}
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 local n=0
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 for k in pairs(t) do
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 n=n+1 s[n]=k
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 end
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 table.sort(s)
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14 for k,v in ipairs(s) do
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
15 print(i,v)
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
16 v=t[v]
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
17 if type(v)=="table" and not seen[v] then
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
18 dump(v,i.."\t")
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
19 end
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
20 end
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
21 end
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
22
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
23 dump(_G,"")
3e148db7f933 Add tests/ to the repo
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
24

mercurial