oldTerm.write = _G.term.write
oldTerm.setCursorPos = _G["term"]["setCursorPos"]
oldTerm.getCursorPos = _G["term"]["getCursorPos"]
oldTerm.clear = _G["term"]["clear"]
oldTerm.setBackgroundColour = _G["term"]["setBackgroundColour"]
oldTerm.setTextColour = _G["term"]["setTextColour"]
function term.write( ... )
local arg = { ... }
log.add( "wrote", unpack( arg ) )
oldTerm.write( unpack( arg ) )
end
This should work i think...it doesn't get any errors and if i run it 1 time then it's fine and nothing changes however if i try a second time to run the code this is in either the computer shuts down or term.write doesn't workThe only possible explanation i can think of is that when i first run it, log.add doesn't exist so it doesn't overwrite term.write but the second time it does and term.write is broken
I have no idea how to fix it...please help
edit: the code works fine every time if i comment out the last 5 lines above
edit2: if i run it uncommented the first time then run it again commented then it does the same error thing
Solution: i changed term.write back to the original at the end of the code and it all seems to work fine now












