[Debugging] using io.stdin:read for first time.
Posted: Fri Apr 17, 2009 7:11 am
Hey Elv, and sailor.
I've got this curious issue. In my scripts I'm going to allow a menu driven system.
I'm using the following function for input
However when I call it for the first time, the script value that was entered is automatically entered.
For example MM loads, then I enter: "my_test.lua" then when calling the io.stdin:read function the script name shows.
I show u a nice quick example of what I mean:
Displays:

Any ideas how I can remove the script name from the buffer before I start asking for input? It is not a big deal for me since my scripts get called by batch files so nothing is in the buffer then, but just thought it's worth mentioning.
I've got this curious issue. In my scripts I'm going to allow a menu driven system.
I'm using the following function for input
Code: Select all
io.stdin:read'*l'
For example MM loads, then I enter: "my_test.lua" then when calling the io.stdin:read function the script name shows.
I show u a nice quick example of what I mean:
Code: Select all
function main()
local l_option = io.stdin:read'*l'
print("l_option: \'" .. l_option .. "\'")
end
startMacro(main)

Any ideas how I can remove the script name from the buffer before I start asking for input? It is not a big deal for me since my scripts get called by batch files so nothing is in the buffer then, but just thought it's worth mentioning.