Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions _state.go
Original file line number Diff line number Diff line change
Expand Up @@ -1571,6 +1571,8 @@ func (ls *LState) PCall(nargs, nret int, errfunc *LFunction) (err error) {
ls.stack.SetSp(sp)
if sp == 0 {
ls.currentFrame = nil
} else {
ls.currentFrame = ls.stack.Last()
}
}()

Expand Down
5 changes: 5 additions & 0 deletions baselib.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ func baseDoFile(L *LState) int {
src := L.ToString(1)
top := L.GetTop()
if err := L.DoFile(src); err != nil {
if _, ok := err.(*ApiError); ok {
// if the error is *ApiError, runs panic directly to prevent overriding a stacktrace in the error object.
panic(err)
}

L.RaiseError(err.Error())
}
return L.GetTop() - top
Expand Down
2 changes: 2 additions & 0 deletions state.go
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,8 @@ func (ls *LState) PCall(nargs, nret int, errfunc *LFunction) (err error) {
ls.stack.SetSp(sp)
if sp == 0 {
ls.currentFrame = nil
} else {
ls.currentFrame = ls.stack.Last()
}
}()

Expand Down