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

Any ideas on how a program takes 2 of one char?

Started by Dave-ee Jones, 21 August 2017 - 01:34 AM
Dave-ee Jones #1
Posted 21 August 2017 - 03:34 AM
Sorry, this is going to be hard to explain.

So I was working on a re-write of HSH (remote shell program), when I stumbled across something weird..

I had called the read() function in a separate window, e.g.

local w = window.create(term.current()..)
term.redirect(w)
local _i = read()
And for some reason it was taking 2 of the first character I put in, e.g. if I entered '5' it would put in '55' and then wouldn't happen again, it was only for the first character put in. Not to mention after I had exited the read() function (pressed 'Enter') it would break the program and error out. Except there was no error (It's running in a coroutine so the coroutine just reports as dead, no error :/ ).

Any ideas on why this is? If needed I can supply the whole code, just didn't think it would be worth you reading 500 lines or so..

EDIT: I figured something out…There's a separate coroutine that's running a separate shell and the second character of those 2 is calling another read() function (so you can run a program). I realised this because it had auto-completion for 'label' and other programs..
Edited on 21 August 2017 - 01:37 AM
Dave-ee Jones #2
Posted 21 August 2017 - 04:11 AM
This issue can be closed, as the problem was resolved (see the edit of the first post).