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

Method postCall

stack.go:343–365  ·  view source on GitHub ↗
(firstResult int)

Source from the content-addressed store, hash-verified

341}
342
343func (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

Callers 3

executeSwitchMethod · 0.95
callGoMethod · 0.95
initFunction · 0.80

Calls 1

hookMethod · 0.95

Tested by

no test coverage detected