CallWithContinuation is exactly like Call, but allows the called function to yield. http://www.lua.org/manual/5.2/manual.html#lua_callk
(argCount, resultCount, context int, continuation Function)
| 332 | // |
| 333 | // http://www.lua.org/manual/5.2/manual.html#lua_callk |
| 334 | func (l *State) CallWithContinuation(argCount, resultCount, context int, continuation Function) { |
| 335 | if apiCheck && continuation != nil && l.callInfo.isLua() { |
| 336 | panic("cannot use continuations inside hooks") |
| 337 | } |
| 338 | l.checkElementCount(argCount + 1) |
| 339 | if apiCheck && l.shouldYield { |
| 340 | panic("cannot do calls on non-normal thread") |
| 341 | } |
| 342 | l.checkResults(argCount, resultCount) |
| 343 | f := l.top - (argCount + 1) |
| 344 | if continuation != nil && l.nonYieldableCallCount == 0 { // need to prepare continuation? |
| 345 | l.callInfo.continuation = continuation |
| 346 | l.callInfo.context = context |
| 347 | l.call(f, resultCount, true) // just do the call |
| 348 | } else { // no continuation or not yieldable |
| 349 | l.call(f, resultCount, false) // just do the call |
| 350 | } |
| 351 | l.adjustResults(resultCount) |
| 352 | } |
| 353 | |
| 354 | // ProtectedCall calls a function in protected mode. Both argCount and |
| 355 | // resultCount have the same meaning as in Call. If there are no errors |
no test coverage detected