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

Method call

stack.go:370–386  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
370func (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
388func (l *State) throw(errorCode error) {
389 if l.protectFunction != nil {

Callers 7

errorMessageMethod · 0.95
CallWithContinuationMethod · 0.95
executeSwitchMethod · 0.95
callTagMethodMethod · 0.95
callTagMethodVMethod · 0.95
initFunction · 0.80

Calls 4

runtimeErrorMethod · 0.95
throwMethod · 0.95
preCallMethod · 0.95
executeMethod · 0.95

Tested by

no test coverage detected