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

Function Traceback

auxiliary.go:48–77  ·  view source on GitHub ↗

Traceback creates and pushes a traceback of the stack l1. If message is not nil it is appended at the beginning of the traceback. The level parameter tells at which level to start the traceback.

(l, l1 *State, message string, level int)

Source from the content-addressed store, hash-verified

46// nil it is appended at the beginning of the traceback. The level parameter
47// tells at which level to start the traceback.
48func Traceback(l, l1 *State, message string, level int) {
49 const levels1, levels2 = 12, 10
50 levels := countLevels(l1)
51 mark := 0
52 if levels > levels1+levels2 {
53 mark = levels1
54 }
55 buf := message
56 if buf != "" {
57 buf += "\n"
58 }
59 buf += "stack traceback:"
60 for f, ok := Stack(l1, level); ok; f, ok = Stack(l1, level) {
61 if level++; level == mark {
62 buf += "\n\t..."
63 level = levels - levels2
64 } else {
65 d, _ := Info(l1, "Slnt", f)
66 buf += "\n\t" + d.ShortSource + ":"
67 if d.CurrentLine > 0 {
68 buf += fmt.Sprintf("%d:", d.CurrentLine)
69 }
70 buf += " in " + functionName(l, d)
71 if d.IsTailCall {
72 buf += "\n\t(...tail calls...)"
73 }
74 }
75 }
76 l.PushString(buf)
77}
78
79// MetaField pushes onto the stack the field event from the metatable of the
80// object at index. If the object does not have a metatable, or if the

Callers 1

debug.goFile · 0.85

Calls 5

countLevelsFunction · 0.85
StackFunction · 0.85
InfoFunction · 0.85
functionNameFunction · 0.85
PushStringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…