Added support to pass extra arguments to functions on core.add_thread
This commit is contained in:
+4
-2
@@ -953,9 +953,11 @@ function core.show_title_bar(show)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function core.add_thread(f, weak_ref)
|
function core.add_thread(f, weak_ref, ...)
|
||||||
local key = weak_ref or #core.threads + 1
|
local key = weak_ref or #core.threads + 1
|
||||||
local fn = function() return core.try(f) end
|
local args = {...}
|
||||||
|
local unpack = unpack or table.unpack
|
||||||
|
local fn = function() return core.try(f, unpack(args)) end
|
||||||
core.threads[key] = { cr = coroutine.create(fn), wake = 0 }
|
core.threads[key] = { cr = coroutine.create(fn), wake = 0 }
|
||||||
return key
|
return key
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user