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

Method MaxN

table.go:106–116  ·  view source on GitHub ↗

MaxN returns a maximum number key that nil value does not exist before it.

()

Source from the content-addressed store, hash-verified

104
105// MaxN returns a maximum number key that nil value does not exist before it.
106func (tb *LTable) MaxN() int {
107 if tb.array == nil {
108 return 0
109 }
110 for i := len(tb.array) - 1; i >= 0; i-- {
111 if tb.array[i] != LNil {
112 return i + 1
113 }
114 }
115 return 0
116}
117
118// Remove removes from this table the element at a given position.
119func (tb *LTable) Remove(pos int) LValue {

Callers 4

TestTableMaxNFunction · 0.80
TestTableRemoveFunction · 0.80
TestTableRawSetIntFunction · 0.80
tableMaxNFunction · 0.80

Calls

no outgoing calls

Tested by 3

TestTableMaxNFunction · 0.64
TestTableRemoveFunction · 0.64
TestTableRawSetIntFunction · 0.64