summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunwox <me@unwox.com>2025-09-04 19:49:41 +0600
committerunwox <me@unwox.com>2025-09-04 19:49:41 +0600
commit0cd409fe6671f045f4c7931506dc5fd42a5a400c (patch)
treed04b8d617c5b0cab97fa62b1bfcc2d87ffd84434
parent5e9fb54aaedcf5949e42c0d8e7a25093bdc6ac14 (diff)
fix coroutines on lua app init
-rw-r--r--worker.go10
1 files changed, 10 insertions, 0 deletions
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
}