Difference between revisions of "Thread"

(documented how to debug threads with stack traces)
Line 14: Line 14:
 
== Supertypes ==
 
== Supertypes ==
 
[[Object]]
 
[[Object]]
 +
== Notes ==
 +
Threads will place all Lua errors in "error".
 +
To retrieve the error, call thread:receive('error') in the main thread.
 
== See Also ==
 
== See Also ==
 
* [[parent::love.thread]]
 
* [[parent::love.thread]]

Revision as of 20:01, 8 August 2011

Available since LÖVE 0.7.0
This type is not supported in earlier versions.

A Thread is a chunk of code that can run in parallel with other threads.

Constructors

love.thread.newThreadCreates a new Thread from a filename, string or FileData object containing Lua code.

Functions

Object:typeGets the type of the object as a string.
Object:typeOfChecks whether an object is of a certain type.
Thread:demandReceive a message from a thread. Wait for the message to exist before returning.
Thread:getNameGet the name of a thread.
Thread:killForcefully terminate the thread.
Thread:peekReceive a message from a thread, but leave it in the message box.
Thread:receiveReceive a message from a thread.
Thread:sendSend a message.
Thread:startStarts the thread.
Thread:waitWait for a thread to finish.

Supertypes

Object

Notes

Threads will place all Lua errors in "error". To retrieve the error, call thread:receive('error') in the main thread.

See Also

Other Languages