I’m looking to emulate the behaviour of standard Lua ‘io.read()’ functionality - as in the following example.
local answer repeat io.write("continue with this operation (y/n)? ") io.flush() answer=io.read() until answer=="y" or answer=="n"
This doesn’t seem to work out of the box - Lumberyard hangs forever without the ability to input anything. Basically I’d like to hook into the UI Canvas OnAction system (be it from a button press, text box ‘enter’, whatever) and have the engine wait until a certain OnAction event has been triggered before continuing as normal. Here’s some pseudocode of what I’m looking for:
... earlier code while (inputNotReceived) do self:GetPlayerInput if (playerInput == something) then doSomething() else doSomeThingElse() end end
I’ve looked into coroutines for this as well, however they seem to behave extremely strangely in Lumberyard and can’t seem to be counted on to work properly.