-
-
Save EliterScripts/2647c5d675979260233a02be60dc1917 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
do | |
local commandThread; | |
if(commandThread == nil)then | |
commandThread = love.thread.newThread("game/server/commandLineOutputThread.lua") | |
commandThread:start() | |
end | |
local function oldPrint(...) | |
local Args = {...} | |
print(unpack(Args)) | |
end | |
function print(...) | |
local Args = { ... } | |
local outputChannel = nil | |
local stat, err = pcall(function() | |
outputChannel = love.thread.getChannel("printed-output") | |
local succ = outputChannel:supply(Args, 0.05) | |
if(succ == false)then | |
return error("printing to printing output channel timed out.") | |
end | |
end) | |
if(stat == false)then | |
oldPrint(unpack(Args)) | |
oldPrint("Error printing output through printed-out channel: " .. err) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment