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

Method ProtectedCall

lua.go:381–383  ·  view source on GitHub ↗

ProtectedCall calls a function in protected mode. Both argCount and resultCount have the same meaning as in Call. If there are no errors during the call, ProtectedCall behaves exactly like Call. However, if there is any error, ProtectedCall catches it, pushes a single value on the stack (the error

(argCount, resultCount, errorFunction int)

Source from the content-addressed store, hash-verified

379//
380// http://www.lua.org/manual/5.2/manual.html#lua_pcall
381func (l *State) ProtectedCall(argCount, resultCount, errorFunction int) error {
382 return l.ProtectedCallWithContinuation(argCount, resultCount, errorFunction, 0, nil)
383}
384
385// ProtectedCallWithContinuation behaves exactly like ProtectedCall, but
386// allows the called function to yield.

Callers 12

TestLuaFunction · 0.95
benchmarkSortFunction · 0.95
BenchmarkFibonnaciFunction · 0.95
TestUserDataEqualityNilFunction · 0.95
TestErrorFunction · 0.95
TestErrorfFunction · 0.95
TestLocIsCorrectOnErrorFunction · 0.95
DoFileFunction · 0.80
DoStringFunction · 0.80

Calls 1

Tested by 10

TestLuaFunction · 0.76
benchmarkSortFunction · 0.76
BenchmarkFibonnaciFunction · 0.76
TestUserDataEqualityNilFunction · 0.76
TestErrorFunction · 0.76
TestErrorfFunction · 0.76
TestLocIsCorrectOnErrorFunction · 0.76