diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-28 16:23:06 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-28 16:23:06 +0000 |
commit | 0371e07ab64fc457f74a6640f06a5b439038ceee (patch) | |
tree | dda15773f5bce673944f1a61f578c22f0c70cdb6 /crawl-ref/source/dat/clua/util.lua | |
parent | fec3e431ad8d5c47c29a20c4dc81820f867fda23 (diff) | |
download | crawl-ref-0371e07ab64fc457f74a6640f06a5b439038ceee.tar.gz crawl-ref-0371e07ab64fc457f74a6640f06a5b439038ceee.zip |
On a crash, do consistency checking on the level's markers, dump the level's
markers, and dump the persistant Lua data.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8839 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/dat/clua/util.lua')
-rw-r--r-- | crawl-ref/source/dat/clua/util.lua | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/crawl-ref/source/dat/clua/util.lua b/crawl-ref/source/dat/clua/util.lua index fab5720a7a..2aa4f2fe85 100644 --- a/crawl-ref/source/dat/clua/util.lua +++ b/crawl-ref/source/dat/clua/util.lua @@ -250,4 +250,28 @@ function util.Timer:mark(what) local now = crawl.millis() crawl.mpr(what .. ": " .. (now - last) .. " ms") self.last = now -end
\ No newline at end of file +end + +-- Turn contents of a table into a human readable string +function table_to_string(table, depth) + depth = depth or 0 + + local indent = string.rep(" ", depth * 4) + + local str = "" + + for key, value in pairs(table) do + str = str .. indent .. key .. ": " + + if type(value) == "table" then + str = str .. "\n" .. table_to_string(value, depth + 1) + elseif type(value) == "function" then + str = str .. "function" + else + str = str .. value + end + str = str .. "\n" + end + + return str +end |