MCPcopy Index your code
hub / github.com/yuin/gopher-lua / GetStack

Method GetStack

state.go:1803–1818  ·  view source on GitHub ↗
(level int)

Source from the content-addressed store, hash-verified

1801}
1802
1803func (ls *LState) GetStack(level int) (*Debug, bool) {
1804 frame := ls.currentFrame
1805 for ; level > 0 && frame != nil; frame = frame.Parent {
1806 level--
1807 if !frame.Fn.IsG {
1808 level -= frame.TailCall
1809 }
1810 }
1811
1812 if level == 0 && frame != nil {
1813 return &Debug{frame: frame}, true
1814 } else if level < 0 && ls.stack.Sp() > 0 {
1815 return &Debug{frame: ls.stack.At(0)}, true
1816 }
1817 return &Debug{}, false
1818}
1819
1820func (ls *LState) GetLocal(dbg *Debug, no int) (string, LValue) {
1821 frame := dbg.frame

Callers 5

whereMethod · 0.95
stackTraceMethod · 0.95
debugGetInfoFunction · 0.45
debugGetLocalFunction · 0.45
debugSetLocalFunction · 0.45

Calls 2

SpMethod · 0.65
AtMethod · 0.65

Tested by

no test coverage detected