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

Function Where

auxiliary.go:190–199  ·  view source on GitHub ↗

Where pushes onto the stack a string identifying the current position of the control at level in the call stack. Typically this string has the following format: chunkname:currentline: Level 0 is the running function, level 1 is the function that called the running function, etc. This function is us

(l *State, level int)

Source from the content-addressed store, hash-verified

188//
189// This function is used to build a prefix for error messages.
190func Where(l *State, level int) {
191 if f, ok := Stack(l, level); ok { // check function at level
192 ar, _ := Info(l, "Sl", f) // get info about it
193 if ar.CurrentLine > 0 { // is there info?
194 l.PushString(fmt.Sprintf("%s:%d: ", ar.ShortSource, ar.CurrentLine))
195 return
196 }
197 }
198 l.PushString("") // else, no information available...
199}
200
201// Errorf raises an error. The error message format is given by format plus
202// any extra arguments, following the same rules as PushFString. It also adds

Callers 2

base.goFile · 0.85
ErrorfFunction · 0.85

Calls 3

StackFunction · 0.85
InfoFunction · 0.85
PushStringMethod · 0.80

Tested by

no test coverage detected