Call a Go or Lua function. The function to be called is at function. The arguments are on the stack, right after the function. On return, all the results are on the stack, starting at the original function position.
(function int, resultCount int, allowYield bool)
| 368 | // The arguments are on the stack, right after the function. On return, all the |
| 369 | // results are on the stack, starting at the original function position. |
| 370 | func (l *State) call(function int, resultCount int, allowYield bool) { |
| 371 | if l.nestedGoCallCount++; l.nestedGoCallCount == maxCallCount { |
| 372 | l.runtimeError("Go stack overflow") |
| 373 | } else if l.nestedGoCallCount >= maxCallCount+maxCallCount>>3 { |
| 374 | l.throw(ErrorError) // error while handling stack error |
| 375 | } |
| 376 | if !allowYield { |
| 377 | l.nonYieldableCallCount++ |
| 378 | } |
| 379 | if !l.preCall(function, resultCount) { // is a Lua function? |
| 380 | l.execute() // call it |
| 381 | } |
| 382 | if !allowYield { |
| 383 | l.nonYieldableCallCount-- |
| 384 | } |
| 385 | l.nestedGoCallCount-- |
| 386 | } |
| 387 | |
| 388 | func (l *State) throw(errorCode error) { |
| 389 | if l.protectFunction != nil { |
no test coverage detected