code: func (l *State) ProtectedCallWithContinuation(argCount, resultCount, errorFunction, context int, continuation Function) (err error) {
  	if apiCheck && continuation != nil && l.callInfo.isLua() {
  		panic("cannot use continuations inside hooks")
  	}
  	l.checkElementCount(argCount + 1)
  	if apiCheck && l.shouldYield {
  		panic("cannot do calls on non-normal thread")
  	}
  	l.checkResults(argCount, resultCount)
  	if errorFunction != 0 {
  		apiCheckStackIndex(errorFunction, l.indexToValue(errorFunction))
  		errorFunction = l.AbsIndex(errorFunction)
  	}
  
  	f := l.top - (argCount + 1)
  
  	if continuation == nil || l.nonYieldableCallCount > 0 {
  		err = l.protectedCall(func() { l.call(f, resultCount, false) }, f, errorFunction)
  	} else {
  		c := l.callInfo
  		c.continuation, c.context, c.extra, c.oldAllowHook, c.oldErrorFunction = continuation, context, f, l.allowHook, l.errorFunction
  		l.errorFunction = errorFunction
  		l.callInfo.setCallStatus(callStatusYieldableProtected)
  		l.call(f, resultCount, true)
  		l.callInfo.clearCallStatus(callStatusYieldableProtected)
  		l.errorFunction = c.oldErrorFunction
  	}
  	l.adjustResults(resultCount)
  	return
  }
docs: // ProtectedCallWithContinuation behaves exactly like ProtectedCall, but
  // allows the called function to yield.
  //
  // http://www.lua.org/manual/5.2/manual.html#lua_pcallk