Jump to content




read(nil, nil, function)

command lua

4 replies to this topic

#1 Sewbacca

  • Members
  • 450 posts
  • LocationStar Wars

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.

#2 Anavrins

  • Members
  • 775 posts

Posted 25 March 2016 - 03:59 PM

View PostSewbacca, on 25 March 2016 - 02:06 PM, said:

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 by Anavrins, 25 March 2016 - 04:00 PM.


#3 Sewbacca

  • Members
  • 450 posts
  • LocationStar Wars

Posted 25 March 2016 - 04:03 PM

thanks

#4 Anavrins

  • Members
  • 775 posts

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 by Anavrins, 25 March 2016 - 04:50 PM.


#5 Sewbacca

  • Members
  • 450 posts
  • LocationStar Wars

Posted 25 March 2016 - 08:45 PM

Thx





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users