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

Method protectedCall

lua.go:1239–1251  ·  view source on GitHub ↗
(f func(), oldTop, errorFunc int)

Source from the content-addressed store, hash-verified

1237}
1238
1239func (l *State) protectedCall(f func(), oldTop, errorFunc int) error {
1240 callInfo, allowHook, nonYieldableCallCount, errorFunction := l.callInfo, l.allowHook, l.nonYieldableCallCount, l.errorFunction
1241 l.errorFunction = errorFunc
1242 err := l.protect(f)
1243 if err != nil {
1244 l.close(oldTop)
1245 l.setErrorObject(err, oldTop)
1246 l.callInfo, l.allowHook, l.nonYieldableCallCount = callInfo, allowHook, nonYieldableCallCount
1247 // TODO l.shrinkStack()
1248 }
1249 l.errorFunction = errorFunction
1250 return err
1251}
1252
1253// UpValue returns the name of the upvalue at index away from function,
1254// where index cannot be greater than the number of upvalues.

Callers 3

toNumberMethod · 0.95
protectedParserFunction · 0.80

Calls 3

protectMethod · 0.95
closeMethod · 0.95
setErrorObjectMethod · 0.95

Tested by

no test coverage detected