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

Read() and limit length of the input field

Started by VaNnOrus, 26 November 2013 - 08:30 AM
VaNnOrus #1
Posted 26 November 2013 - 09:30 AM
Is there any way to limit the length of the input field or automatically transfer cursor to the next line when approaching the edge of the screen in the function "read()"?
Wojbie #2
Posted 26 November 2013 - 09:33 AM
Not in standard read() function. You can however write your own version of read function that does exactly what you need.
If you take a look into bios.lua file you can find definition of standard read that you can edit if you don't want to write it from scratch.
Zudo #3
Posted 26 November 2013 - 11:49 AM
I believe there is an api that does this.
VaNnOrus #4
Posted 26 November 2013 - 08:56 PM
Not in standard read() function. You can however write your own version of read function that does exactly what you need. If you take a look into bios.lua file you can find definition of standard read that you can edit if you don't want to write it from scratch.
Oh, thanx, I try rewrite this function :)/>
I will write here when I'll get the desired result :3
Edited on 26 November 2013 - 07:58 PM
theoriginalbit #5
Posted 26 November 2013 - 10:05 PM
Oh, thanx, I try rewrite this function :)/>
I will write here when I'll get the desired result :3
If you are feeling exceptionally lazy I do have a working implementation. Its a rewrite I performed of the default `read` but more efficient, and more capabilities, best of all without breaking default usages. You can find more information about it in my programs thread under code snippets.
VaNnOrus #6
Posted 30 November 2013 - 02:33 AM
If you are feeling exceptionally lazy I do have a working implementation. Its a rewrite I performed of the default `read` but more efficient, and more capabilities, best of all without breaking default usages. You can find more information about it in my programs thread under code snippets.
It's interesting, I use some things in my function, thanx :)/>

– UPD
that's what I did, but have not yet written walking the cursor line by line

[attachment=1405:11.png]
Edited on 30 November 2013 - 02:45 AM