summaryrefslogtreecommitdiff
path: root/worker.go
diff options
context:
space:
mode:
authorunwox <me@unwox.com>2025-10-13 22:25:27 +0600
committerunwox <me@unwox.com>2025-10-13 22:25:27 +0600
commit06d94fe7f16e8985878a24332978731439599c4e (patch)
treebfecb440546167aa34575a1bed94c24f1bf59231 /worker.go
parentaadee458066c5d623ae2a16b8957f51418139fcd (diff)
fix error handling
Diffstat (limited to 'worker.go')
-rw-r--r--worker.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/worker.go b/worker.go
index d252708..ea4892a 100644
--- a/worker.go
+++ b/worker.go
@@ -110,7 +110,6 @@ func (w *Worker) Start(argv []string, module map[string]any) error {
return err
}
w.lua.SetGlobal("fennel")
-
err = w.lua.LoadAndCall(`
debug.traceback = fennel.traceback
fennel.install()
@@ -342,12 +341,12 @@ func (w *Worker) Eval(code string) error {
w.mu.Lock()
defer w.mu.Unlock()
if w.evalFn != nil {
+ // FIXME: does this branch pollute stack?
w.lua.PushFromRef(*w.evalFn)
w.lua.PushString(code)
- return w.lua.PCall(1, 0, 0)
+ return w.lua.PCall(1, 0, 1)
}
err := w.lua.LoadAndCall(code)
- w.lua.Pop(w.lua.StackLen())
return err
}