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

Detecting length of read()

Started by GemCow, 22 October 2015 - 08:58 PM
GemCow #1
Posted 22 October 2015 - 10:58 PM
local input = read()
how do i detect the length of the read
Bomb Bloke #2
Posted 22 October 2015 - 11:21 PM
#input, input:len(), or string.len(input).

See here for some other things you can do with text strings.
GemCow #3
Posted 23 October 2015 - 12:19 AM
#input, input:len(), or string.len(input).

See here for some other things you can do with text strings.
nvm, i found out i can do event == 'key'
TYKUHN2 #4
Posted 23 October 2015 - 02:37 AM
read():len() is probably better unless you intend to print it to the screen as it comes in.