Difference between revisions of "love.thread"

m
Line 1: Line 1:
{{newin|[[0.7.0]]|type=module}}
+
{{newin|[[0.7.0]]|070|type=module}}
 
Allows you to work with threads.
 
Allows you to work with threads.
  

Revision as of 13:53, 4 May 2012

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

Allows you to work with threads.

Threads are separate Lua environments, running in parallel to the main code. As their code runs separately, they can be used to compute complex operations without adversely affecting the frame rate of the main thread. However, as they are separate environments, they cannot access the variables and functions of the main thread, and communication between threads is limited.

O.png The modules love.graphics and love.event do not work with love.thread. Don't call their functions in a Thread other than main.  


Types

ChannelAn object which can be used to send and receive data between different threads.
ThreadA Thread represents a thread.

Functions

love.thread.getChannelCreates or retrieves a named thread channel.
love.thread.getThreadLook for a thread and get its object.
love.thread.getThreadsGet all threads.
love.thread.newChannelCreates a new unnamed thread channel.
love.thread.newThreadCreates a new Thread from a filename, string or FileData object containing Lua code.


See Also

Other Languages