|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ILuaContext
An interface passed to peripherals and ILuaObjects' by computers or turtles, providing methods that allow the peripheral call to wait for events before returning, just like in lua. This is very useful if you need to signal work to be performed on the main thread, and don't want to return until the work has been completed.
Method Summary | |
---|---|
java.lang.Object[] |
pullEvent(java.lang.String filter)
Wait for an event to occur on the computer, suspending the thread until it arises. |
java.lang.Object[] |
pullEventRaw(java.lang.String filter)
The same as pullEvent(), except "terminated" events are ignored. |
java.lang.Object[] |
yield(java.lang.Object[] arguments)
Yield the current coroutine with some arguments until it is resumed. |
Method Detail |
---|
java.lang.Object[] pullEvent(java.lang.String filter) throws java.lang.Exception, java.lang.InterruptedException
filter
- A specific event to wait for, or null to wait for any event
java.lang.Exception
- If the user presses CTRL+T to terminate the current program while pullEvent() is waiting for an event, a "Terminated" exception will be thrown here.
Do not attempt to block this exception, unless you wish to prevent termination, which is not recommended.
java.lang.InterruptedException
- If the user shuts down or reboots the computer while pullEvent() is waiting for an event, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computer will leak memory and end up in a broken state.java.lang.Object[] pullEventRaw(java.lang.String filter) throws java.lang.InterruptedException
filter
- A specific event to wait for, or null to wait for any event
java.lang.InterruptedException
- If the user shuts down or reboots the computer while pullEventRaw() is waiting for an event, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computer will leak memory and end up in a broken state.pullEvent(String)
java.lang.Object[] yield(java.lang.Object[] arguments) throws java.lang.InterruptedException
arguments
- An object array containing the arguments to pass to coroutine.yield()
java.lang.InterruptedException
- If the user shuts down or reboots the computer the coroutine is suspended, InterruptedException will be thrown. This exception must not be caught or intercepted, or the computer will leak memory and end up in a broken state.pullEvent(String)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |