summaryrefslogtreecommitdiffstats
path: root/lib/debugs.lua
blob: 9ff9e9d92a883a0f0ec7290a0dca68fc7ab55ca0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--Show various debug information

module(..., package.seeall)

require("session")
--local cnt = 0

function serialize ( view, cnt )
	if type(view) == "string" then
		io.write(" ><span2 style='color:black'>")
		io.write(string.format("%q", view))
		io.write("</span2><")
	elseif type(view) == "number" then
		io.write(" ><span2 style='color:black'>")
		io.write(view)
		io.write("</span2><")
	elseif type(view) == "table" then
		cnt = cnt + 1
--		io.write("<BR>")
		for k,v in pairs(view) do
			io.write("<br>")
			io.write(string.rep("{ ",cnt), "<B>", k, "</B>")
			serialize(v, cnt)
		end
--		io.write("}\n")
	else
		error("Cannot serialize a " .. type(view))
	end
end

function variables ( view )
	io.write [[
	<span style='color:#D2691E;font-family:courier;'>
	<h2>DEBUG INFO: THIS VIEW CONTAINS THE FOLLOWING VARIABLES/TABLES</h2>
	------------ START DEBUG INFORMATION ------------<BR>]]
	serialize(view,0)
	io.write( "<BR><BR>------------ END DEBUG INFORMATION ------------</span>")
	return
end