diff --git a/updatedshmup.p8 b/updatedshmup.p8 index 89ae6b7..b7c506a 100644 --- a/updatedshmup.p8 +++ b/updatedshmup.p8 @@ -9,8 +9,6 @@ game = 1 win = 2 lose = 3 -debug = {} - function usplit(str) return unpack(split(str)) end @@ -251,7 +249,6 @@ end function _draw() drawgame() - draw_debug() if (state == game) fadelvl = -45 if (state == win) dropshadow("win",50,61,11) if (state == lose) dropshadow("fail",48,61,8) @@ -291,21 +288,19 @@ function fadescreen() end end -function draw_debug() - cursor(0,0,7) - -- uncomment the followingh - -- to display object counts ---[[ - print("es "..tostr(#eships)) - print("eb "..tostr(#ebullets)) - print("pb "..tostr(#pbullets)) - print("ib "..tostr(#intangibles_bg)) - print("if "..tostr(#intangibles_fg)) - print("v "..tostr(#events)) -]] - if (#debug==0) return - foreach(debug,print) - debug={} +function puke(item, indent) + indent = indent or 0 + local pfx = "" + for _=1,indent do + pfx ..= " " + end + if (type(item) ~= "table") return pfx..tostr(item) + ret = pfx.."{" + pfx = "\n"..pfx + for k, v := pairs(item) do + ret ..= pfx..tostr(k)..": "..puke(v, indent+1) + end + return ret..pfx.."}" end function drawgame()