Skip to content

Instantly share code, notes, and snippets.

@EliterScripts
Created December 12, 2018 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EliterScripts/2647c5d675979260233a02be60dc1917 to your computer and use it in GitHub Desktop.
Save EliterScripts/2647c5d675979260233a02be60dc1917 to your computer and use it in GitHub Desktop.
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