MCPcopy Index your code
hub / github.com/Shopify/go-lua / Next

Method Next

lua.go:1191–1200  ·  view source on GitHub ↗

Next pops a key from the stack and pushes a key-value pair from the table at index, while the table has next elements. If there are no more elements, nothing is pushed on the stack and Next returns false. A typical traversal looks like this: Table is on top of the stack (index -1). l.PushNil() //

(index int)

Source from the content-addressed store, hash-verified

1189//
1190// http://www.lua.org/manual/5.2/manual.html#lua_next
1191func (l *State) Next(index int) bool {
1192 t := l.indexToValue(index).(*table)
1193 if l.next(t, l.top-1) {
1194 l.apiIncrementTop()
1195 return true
1196 }
1197 // no more elements
1198 l.top-- // remove key
1199 return false
1200}
1201
1202// Concat concatenates the n values at the top of the stack, pops them, and
1203// leaves the result at the top. If n is 1, the result is the single value

Callers 3

TestTableNextFunction · 0.95
nextFunction · 0.80
findFieldFunction · 0.80

Calls 3

indexToValueMethod · 0.95
nextMethod · 0.95
apiIncrementTopMethod · 0.95

Tested by 1

TestTableNextFunction · 0.76