Stack gets information about the interpreter runtime stack. It returns a Frame identifying the activation record of the function executing at a given level. Level 0 is the current running function, whereas level n+1 is the function that has called level n (except for tail calls, which do not count
(l *State, level int)
| 191 | // Stack returns true; when called with a level greater than the stack depth, |
| 192 | // it returns false. |
| 193 | func Stack(l *State, level int) (f Frame, ok bool) { |
| 194 | if level < 0 { |
| 195 | return // invalid (negative) level |
| 196 | } |
| 197 | callInfo := l.callInfo |
| 198 | for ; level > 0 && callInfo != &l.baseCallInfo; level, callInfo = level-1, callInfo.previous { |
| 199 | } |
| 200 | if level == 0 && callInfo != &l.baseCallInfo { // level found? |
| 201 | f, ok = callInfo, true |
| 202 | } |
| 203 | return |
| 204 | } |
| 205 | |
| 206 | func functionInfo(p Debug, f closure) (d Debug) { |
| 207 | d = p |
no outgoing calls
no test coverage detected
searching dependent graphs…