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

read(nil, nil, function)

Started by Sewbacca, 25 March 2016 - 01:06 PM
Sewbacca #1
Posted 25 March 2016 - 02:06 PM
Is there a way to give an standard text?
So it returns:


Filename: standardFile_

The _ stands for the cursor.
Anavrins #2
Posted 25 March 2016 - 03:59 PM
Is there a way to give an standard text?
So it returns:


Filename: standardFile_

The _ stands for the cursor.
Unfortunately no, but a very hacky way to achieve this would be to queue a key event for each character right before the read().
Edited on 25 March 2016 - 03:00 PM
Sewbacca #3
Posted 25 March 2016 - 04:03 PM
thanks
Anavrins #4
Posted 25 March 2016 - 04:50 PM
Example code:

local s = "standardFile"
for letter in s:gmatch(".") do os.queueEvent("char", letter) end
read() #-- Will have "standardFile" already written.
Edited on 25 March 2016 - 03:50 PM
Sewbacca #5
Posted 25 March 2016 - 08:45 PM
Thx