sys.TaskFactory(func)method

Create a Task factory function.

Parameters

func

A function to be used as the Task main function.

Return value

Returns a factory function that can be used to create new Task at each call.

Example

local factory = sys.TaskFactory(function(msg, delay) sleep(delay) print(msg) end) -- Create and start two tasks factory("Hello", 1000) factory("World", 2000)