Multi Threading
zune.thread
A library to create multiple lua states and execute in parallel.
Properties
isThread
The current context of running program.
isThread: booleanFunctions
fromModule
Creates a new thread from a module. Resolves relative to the calling module.
fromModule(module: string): ThreadParameters
module: string- The module to load in the new thread.
Throws
- Luau Error
- Require Error
- Memory Error
fromBytecode
Creates a new thread from bytecode.
fromBytecode(bytecode: string | buffer, opts: export type ThreadLoadOptions = {
chunk_name: string?,
native_code_gen: boolean?,
}ThreadLoadOptionsexport type ThreadLoadOptions = {
chunk_name: string?,
native_code_gen: boolean?,
}?): ThreadParameters
bytecode: string | buffer- The bytecode to load in the new thread.opts: ThreadLoadOptions?- The options for loading the bytecode.chunk_name: string?- default:
"(thread)"
- default:
native_code_gen: boolean?- default:
true
- default:
Throws
- Luau Error
- Memory Error
receive
Receives a message from the owner thread.
Will error if called from the main thread.
receive(): ...anyThrows
- Thread Error
- Memory Error
send
Sends a message to the owner thread.
Will error if called from the main thread.
send(...any): ()Parameters
...any- The values to send to the owner thread.
Throws
- Thread Error
- Memory Error
getCpuCount
Gets the number of CPU cores available. If the number cannot be determined, it will return 1.
getCpuCount(): numberLast updated on