From 4191cf2c082eab9e886e36cccfb4b22d7fec11a7 Mon Sep 17 00:00:00 2001 From: rxi Date: Tue, 21 Apr 2020 23:23:08 +0100 Subject: [PATCH] Added `core.try` wrapping of function passed to `core.add_thread` --- data/core/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/core/init.lua b/data/core/init.lua index 9176c12f..08dc7815 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -173,7 +173,8 @@ end function core.add_thread(f, weak_ref) local key = weak_ref or #core.threads + 1 - core.threads[key] = { cr = coroutine.create(f), wake = 0 } + local fn = function() return core.try(f) end + core.threads[key] = { cr = coroutine.create(fn), wake = 0 } end