diff options
author | Mika Havela <mika.havela@gmail.com> | 2007-12-26 15:28:48 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2007-12-26 15:28:48 +0000 |
commit | 727183a3ae8c5f58d672cb3216f499f9c68e089e (patch) | |
tree | 7c0ac44dfa51740d0398905943424aa6bb6466e1 | |
parent | 60ef1fb4acc1788ce083f93c7d5e93ec67b2c157 (diff) | |
download | acf-core-727183a3ae8c5f58d672cb3216f499f9c68e089e.tar.bz2 acf-core-727183a3ae8c5f58d672cb3216f499f9c68e089e.tar.xz |
A temporary tool when coding ACF. This could be used to output all tables/variables in a view.
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@454 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r-- | lib/debugs.lua | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/lib/debugs.lua b/lib/debugs.lua new file mode 100644 index 0000000..c169659 --- /dev/null +++ b/lib/debugs.lua @@ -0,0 +1,64 @@ +--Show various debug information + +module(..., package.seeall) + +-- This will show all tables and their values as debug information +-- +-- USAGE: <? +-- USAGE: require("debugs") +-- USAGE: io.write(debugs.variables(view)) +-- USAGE: ?> +function variables ( view ) + debuginfo = [[ + <span style='color:#D2691E;font-family:courier;'> + <h2>DEBUG INFO: THIS VIEW CONTAINS THE FOLLOWING VARIABLES/TABLES</h2> + ------------ START DEBUG INFORMATION ------------<BR>]] + + --print ("<span style='color:darkblue;font-family:courier;'>") + for a,b in pairs(view) do + if not (type(b) == "table") then + debuginfo = debuginfo .. "<b>" .. a .. "</b>: ><span2 style='color:black'>" .. b .. "</span2><<BR>" + else + debuginfo = debuginfo .. "<b>" .. a .. "</b>:...<BR>" + for c,d in pairs(view[a]) do + if not (type(d) == "table") then + debuginfo = debuginfo .. "<b> { " .. c .. "</b>: ><span2 style='color:black'>" .. d .. "</span2>< <B> }</B><BR>" + else + debuginfo = debuginfo .. "<b> { " .. c .. "</b>:...<BR>" + for e,f in pairs(view[a][c]) do + if not (type(f) == "table") then + debuginfo = debuginfo .. "<b> { { " .. e .. "</b>: ><span2 style='color:black'>" .. f .. "</span2>< <B> } }</B><BR>" + else + debuginfo = debuginfo .. "<b> { { " .. e .. "</b>:...<BR>" + for g,h in pairs(view[a][c][e]) do + if not (type(h) == "table") then + debuginfo = debuginfo .. "<b> { { { " .. g .. "</b>: ><span2 style='color:black'>" .. h .. "</span2>< <B> } } }</B><BR>" + else + debuginfo = debuginfo .. "<b> { { { " .. g .. "</b>:...<BR>" + for i,j in pairs(view[a][c][e][g]) do + if not (type(j) == "table") then + debuginfo = debuginfo .. "<b> { { { { " .. i .. "</b>: ><span2 style='color:black'>" .. j .. "</span2>< <B> } } } }</B><BR>" + else + debuginfo = debuginfo .. "<b> { { { " .. i .. "</b>:...<BR>" + for k,l in pairs(view[a][c][e][g][i]) do + if not (type(l) == "table") then + debuginfo = debuginfo .. "<b> { { { { { " .. i .. "</b>: ><span2 style='color:black'>" .. l .. "</span2>< <B> } } } } }</B><BR>" + end + end + end + end + end + end + end + end + end + end + end + a,b,c,d,e,f,g,h,i,j = nil,nil,nil,nil,nil,nil,nil,nil,nil,nil + end + debuginfo = debuginfo .. "------------ END DEBUG INFORMATION ------------</span>" + return debuginfo +end + + + |