Posted 06 October 2013 - 09:17 AM
I've tried to run 2 functions at once via "parallel.waitForAny()", but the first function goes further and does not stop…
Example :
The Problem is that f1() still is waiting for Input after I've clicked "Cancel".
How i can fix this? Need Answers! :-)
Example :
term.clear()
function f1()
term.setCursorPos(1,1)
x = io.read()
print("Got keyboard input!")
end
function f2()
term.setCursorPos(1,19)
write("Cancel")
term.setCursorPos(1,1)
while true do
local event, button, X, Y = os.pullEvent("mouse_click")
if X <= 10 and Y == 19 and button == 1 then
print("\nCanceled")
break
end
end
end
parallel.waitForAny(f1,f2)
print("\nPress any key to continue!")
local event, key = os.pullEvent("key")
...
The Problem is that f1() still is waiting for Input after I've clicked "Cancel".
How i can fix this? Need Answers! :-)