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

Method indexToReg

state.go:878–891  ·  view source on GitHub ↗
(idx int)

Source from the content-addressed store, hash-verified

876}
877
878func (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
893func (ls *LState) currentLocalBase() int {
894 base := 0

Callers 3

SetTopMethod · 0.95
InsertMethod · 0.95
RemoveMethod · 0.95

Calls 2

currentLocalBaseMethod · 0.95
TopMethod · 0.45

Tested by

no test coverage detected