Last active
May 25, 2020 15:39
-
-
Save ddribin/6e5f91e85825a10fd2a75ce7a9b5b758 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- debug logging | |
function log(...) | |
local arg={...} | |
local msg="" | |
for m in all(arg) do | |
msg=msg.._lstr(m) | |
end | |
_log(msg) | |
end | |
function _lstr(x) | |
if (x==nil) return "[nil]" | |
return tostr(x) | |
end | |
function _log(msg) | |
local prefix= | |
"".. | |
stat(90).. -- year | |
"-".. | |
_lstat(91,2).. -- month | |
"-".. | |
_lstat(92,2).. -- day | |
" ".. | |
_lstat(93,2).. -- hour | |
":".. | |
_lstat(94,2).. -- minute | |
":".. | |
_lstat(95,2).. -- second | |
" (".. | |
tostr(t(),true).. -- frame | |
"): " | |
printh(prefix..msg,"log") | |
end | |
-- stat as an string, padded | |
-- out with leading zeros to | |
-- 'p' characters | |
function _lstat(i,p) | |
i=stat(i) | |
local s=""..i | |
while (#s <p) s = "0"..s | |
return s | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2020-05-24 12:02:17 (0x0000.0888): _init | |
2020-05-24 12:02:20 (0x0003.0888): x:0,y:0 | |
2020-05-24 12:02:20 (0x0003.4ccc): x:0,y:0 | |
2020-05-24 12:02:20 (0x0003.6666): x:0,y:0 | |
2020-05-24 12:02:20 (0x0003.8000): x:0,y:0 | |
2020-05-24 12:02:20 (0x0003.9999): x:0,y:0 | |
2020-05-24 12:02:20 (0x0003.b333): x:0,y:0 | |
2020-05-24 12:02:20 (0x0003.bbbb): x:0,y:0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment