(firstResult int)
| 341 | } |
| 342 | |
| 343 | func (l *State) postCall(firstResult int) bool { |
| 344 | ci := l.callInfo |
| 345 | if l.hookMask&MaskReturn != 0 { |
| 346 | l.hook(HookReturn, -1) |
| 347 | } |
| 348 | result, wanted, i := ci.function, ci.resultCount, 0 |
| 349 | l.callInfo = ci.previous // back to caller |
| 350 | // TODO this is obscure - I don't fully understand the control flow, but it works |
| 351 | for i = wanted; i != 0 && firstResult < l.top; i-- { |
| 352 | l.stack[result] = l.stack[firstResult] |
| 353 | result++ |
| 354 | firstResult++ |
| 355 | } |
| 356 | for ; i > 0; i-- { |
| 357 | l.stack[result] = nil |
| 358 | result++ |
| 359 | } |
| 360 | l.top = result |
| 361 | if l.hookMask&(MaskReturn|MaskLine) != 0 { |
| 362 | l.oldPC = l.callInfo.savedPC // oldPC for caller function |
| 363 | } |
| 364 | return wanted != MultipleReturns |
| 365 | } |
| 366 | |
| 367 | // Call a Go or Lua function. The function to be called is at function. |
| 368 | // The arguments are on the stack, right after the function. On return, all the |
no test coverage detected