Created
January 4, 2017 16:41
-
-
Save Alloyed/51d4bc67b44e91d04ced4d07fea93f36 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
--- A log function that's compatible with lua's standard print function. | |
-- usage: print("hi", table, entity, 3.4) -- output: hi <table:0xdeadbeef> <userdata:0xeeeeeeee> 3.4 | |
local function print(...) | |
local str, sep = "", "" | |
for i=1, select('#', ...) do | |
str = str .. sep .. tostring(select(i, ...)) | |
sep = '\t' | |
end | |
return Isaac.DebugString(str) | |
end | |
-- An onscreen logger, from epicbob57#8905 on #themoddingofisaac discord | |
local eLog = {"Log:"} | |
function mod:eLogDraw() | |
for i,j in ipairs(eLog) do | |
Isaac.RenderText(j,50,i*15,255,255,255,255) | |
end | |
end | |
mod:AddCallback(ModCallbacks.MC_POST_RENDER, mod.eLogDraw); | |
local function eLogWrite(str) | |
table.insert(eLog,str) | |
if #eLog > 10 then | |
table.remove(eLog,1) | |
end | |
end | |
-- more to come? ping me here or on reddit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would use
table.pack(...)
instead ofselect
for iterating the argument list, but i actually don't know if it's better or not.