This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
louitzie's profile picture

help making a screenlogger

Started by louitzie, 10 May 2012 - 06:52 PM
louitzie #1
Posted 10 May 2012 - 08:52 PM
i want to make a screenlogger API so i can get whats on the screen when i want

this is the code in logger


local native = term.native
local term = {}

term.write = function (text)
native.write(text)
end

term.clear = function ()
native.clear()
end

term.clearLine = function ()
native.clearLine()
end

term.getCursorPos = function ()
native.getCursorPos()
end

term.setCursorPos = function (x,y)
xpos=x
ypos=y
native.setCursorPos(x,y)
end

term.setCursorBlink = function (:)/>/>
native.setCursorBlink(:)/>/>
end

term.getSize = function ()
native.getSize()
end

term.scroll = function (n)
native.scroll(n)
end

function getLogger()
return term
end

but when i do this

os.loadAPI("logger")
term.redirect(logger.getLogger())
i get an error
bios:67 attempt to compare __lt on nil and number
MysticT #2
Posted 10 May 2012 - 10:22 PM
You forgot the return in your functions:

term.getSize = function ()
  native.getSize()
end
should be:

term.getSize = function ()
  return native.getSize()
end
Same with getCursorPos.
louitzie #3
Posted 11 May 2012 - 07:01 AM
thanks it worked

now set some standard text in write()
and you have a annoying virus
KaoS #4
Posted 16 November 2012 - 06:57 AM
man you are making an epic program right there. why turn it into a virus that irritates people? I can understand snooping etc cuz it's useful and hard to do. irritating people is just uncool

also: viruses are banned on these forums
Lyqyd #5
Posted 16 November 2012 - 09:19 AM
Nothing in that post justified dragging the topic back up all the way from May. Let's let things die, shall we?