Added support to pass extra arguments to functions on core.add_thread
This commit is contained in:
parent
456126400a
commit
8c0685d440
|
@ -953,9 +953,11 @@ function core.show_title_bar(show)
|
|||
end
|
||||
|
||||
|
||||
function core.add_thread(f, weak_ref)
|
||||
function core.add_thread(f, weak_ref, ...)
|
||||
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 }
|
||||
return key
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue