(level int)
| 1801 | } |
| 1802 | |
| 1803 | func (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 | |
| 1820 | func (ls *LState) GetLocal(dbg *Debug, no int) (string, LValue) { |
| 1821 | frame := dbg.frame |
no test coverage detected