From 0cd409fe6671f045f4c7931506dc5fd42a5a400c Mon Sep 17 00:00:00 2001 From: unwox Date: Thu, 4 Sep 2025 19:49:41 +0600 Subject: fix coroutines on lua app init --- worker.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/worker.go b/worker.go index c0ccc65..baf85ff 100644 --- a/worker.go +++ b/worker.go @@ -89,7 +89,17 @@ func (w *Worker) Start(argv []string, module map[string]any) error { } w.lua.SetGlobal("luna") + waitCh := make(chan bool) + w.lua.yield = func () { + <- waitCh + } + w.lua.resume = func () bool { + waitCh <- true + return true + } + err = w.lua.Require(argv[0]) + if err != nil { return err } -- cgit v1.2.3