(idx int)
| 876 | } |
| 877 | |
| 878 | func (ls *LState) indexToReg(idx int) int { |
| 879 | base := ls.currentLocalBase() |
| 880 | if idx > 0 { |
| 881 | return base + idx - 1 |
| 882 | } else if idx == 0 { |
| 883 | return -1 |
| 884 | } else { |
| 885 | tidx := ls.reg.Top() + idx |
| 886 | if tidx < base { |
| 887 | return -1 |
| 888 | } |
| 889 | return tidx |
| 890 | } |
| 891 | } |
| 892 | |
| 893 | func (ls *LState) currentLocalBase() int { |
| 894 | base := 0 |
no test coverage detected