remove draw_debug since it doesn't work; add "puke" debug helper
linked lists don't have a measurable length. will use a persistent intangible for debug dumps in the future. `puke` however can be used at the CLI to dump a table. I need to write a `listpuke` variant too
This commit is contained in:
parent
da8a5b9589
commit
f67c2da37f
@ -9,8 +9,6 @@ game = 1
|
|||||||
win = 2
|
win = 2
|
||||||
lose = 3
|
lose = 3
|
||||||
|
|
||||||
debug = {}
|
|
||||||
|
|
||||||
function usplit(str)
|
function usplit(str)
|
||||||
return unpack(split(str))
|
return unpack(split(str))
|
||||||
end
|
end
|
||||||
@ -251,7 +249,6 @@ end
|
|||||||
|
|
||||||
function _draw()
|
function _draw()
|
||||||
drawgame()
|
drawgame()
|
||||||
draw_debug()
|
|
||||||
if (state == game) fadelvl = -45
|
if (state == game) fadelvl = -45
|
||||||
if (state == win) dropshadow("win",50,61,11)
|
if (state == win) dropshadow("win",50,61,11)
|
||||||
if (state == lose) dropshadow("fail",48,61,8)
|
if (state == lose) dropshadow("fail",48,61,8)
|
||||||
@ -291,21 +288,19 @@ function fadescreen()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function draw_debug()
|
function puke(item, indent)
|
||||||
cursor(0,0,7)
|
indent = indent or 0
|
||||||
-- uncomment the followingh
|
local pfx = ""
|
||||||
-- to display object counts
|
for _=1,indent do
|
||||||
--[[
|
pfx ..= " "
|
||||||
print("es "..tostr(#eships))
|
end
|
||||||
print("eb "..tostr(#ebullets))
|
if (type(item) ~= "table") return pfx..tostr(item)
|
||||||
print("pb "..tostr(#pbullets))
|
ret = pfx.."{"
|
||||||
print("ib "..tostr(#intangibles_bg))
|
pfx = "\n"..pfx
|
||||||
print("if "..tostr(#intangibles_fg))
|
for k, v := pairs(item) do
|
||||||
print("v "..tostr(#events))
|
ret ..= pfx..tostr(k)..": "..puke(v, indent+1)
|
||||||
]]
|
end
|
||||||
if (#debug==0) return
|
return ret..pfx.."}"
|
||||||
foreach(debug,print)
|
|
||||||
debug={}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function drawgame()
|
function drawgame()
|
||||||
|
Loading…
Reference in New Issue
Block a user