MCPcopy Index your code
hub / github.com/Shopify/go-lua / protect

Method protect

stack.go:405–417  ·  view source on GitHub ↗
(f func())

Source from the content-addressed store, hash-verified

403}
404
405func (l *State) protect(f func()) (err error) {
406 nestedGoCallCount, protectFunction := l.nestedGoCallCount, l.protectFunction
407 l.protectFunction = func() {
408 if e := recover(); e != nil {
409 err = e.(error)
410 l.nestedGoCallCount, l.protectFunction = nestedGoCallCount, protectFunction
411 }
412 }
413 defer l.protectFunction()
414 f()
415 l.nestedGoCallCount, l.protectFunction = nestedGoCallCount, protectFunction
416 return err
417}
418
419func (l *State) hook(event, line int) {
420 if l.hooker == nil || !l.allowHook {

Callers 2

CheckStackMethod · 0.95
protectedCallMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected