From 727183a3ae8c5f58d672cb3216f499f9c68e089e Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Wed, 26 Dec 2007 15:28:48 +0000 Subject: 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 --- lib/debugs.lua | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 lib/debugs.lua (limited to 'lib/debugs.lua') 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: +function variables ( view ) + debuginfo = [[ + +

DEBUG INFO: THIS VIEW CONTAINS THE FOLLOWING VARIABLES/TABLES

+ ------------ START DEBUG INFORMATION ------------
]] + + --print ("") + for a,b in pairs(view) do + if not (type(b) == "table") then + debuginfo = debuginfo .. "" .. a .. ": >" .. b .. "<
" + else + debuginfo = debuginfo .. "" .. a .. ":...
" + for c,d in pairs(view[a]) do + if not (type(d) == "table") then + debuginfo = debuginfo .. " { " .. c .. ": >" .. d .. "< }
" + else + debuginfo = debuginfo .. " { " .. c .. ":...
" + for e,f in pairs(view[a][c]) do + if not (type(f) == "table") then + debuginfo = debuginfo .. " { { " .. e .. ": >" .. f .. "< } }
" + else + debuginfo = debuginfo .. " { { " .. e .. ":...
" + for g,h in pairs(view[a][c][e]) do + if not (type(h) == "table") then + debuginfo = debuginfo .. " { { { " .. g .. ": >" .. h .. "< } } }
" + else + debuginfo = debuginfo .. " { { { " .. g .. ":...
" + for i,j in pairs(view[a][c][e][g]) do + if not (type(j) == "table") then + debuginfo = debuginfo .. " { { { { " .. i .. ": >" .. j .. "< } } } }
" + else + debuginfo = debuginfo .. " { { { " .. i .. ":...
" + for k,l in pairs(view[a][c][e][g][i]) do + if not (type(l) == "table") then + debuginfo = debuginfo .. " { { { { { " .. i .. ": >" .. l .. "< } } } } }
" + 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 ------------
" + return debuginfo +end + + + -- cgit v1.2.3