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

Method length

tables.go:196–213  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

194}
195
196func (t *table) length() int {
197 j := len(t.array)
198 if j > 0 && t.array[j-1] == nil {
199 i := 0
200 for j-i > 1 {
201 m := (i + j) / 2
202 if t.array[m-1] == nil {
203 j = m
204 } else {
205 i = m
206 }
207 }
208 return i
209 } else if t.hash == nil {
210 return j
211 }
212 return t.unboundSearch(j)
213}
214
215func arrayIndex(k value) int {
216 if n, ok := k.(float64); ok {

Callers 2

RawLengthMethod · 0.80
objectLengthMethod · 0.80

Calls 1

unboundSearchMethod · 0.95

Tested by

no test coverage detected