love.thread (简体中文)

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

允许你用模块工作.

线程是独立的Lua环境,平行运行于主代码。它们分别运行各自的代码,可以用来进行复杂的操作而不影响主线程的帧速率。然而,因为它们是独立的环境下,所以它们不能访问主线程的变量和函数,以及线程间的通信。

当一个线程启动时, 它只加载love.thread模块. 所有其他的模块需要用require加载.

O.png love.graphics模块有一些限制,因此它应该只在主线程使用.  

Types

Channel An object which can be used to send and receive data between different threads.
Thread A Thread represents a thread.

Functions

love.thread.getChannel Creates or retrieves a named thread channel.
love.thread.getThread Look for a thread and get its object.
love.thread.getThreads Get all threads.
love.thread.newChannel Creates a new unnamed thread channel.
love.thread.newThread Creates a new Thread from a Lua file or FileData object.


See Also

Other Languages

Personal tools