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

Method Len

table.go:50–63  ·  view source on GitHub ↗

Len returns length of this LTable without using __len.

()

Source from the content-addressed store, hash-verified

48
49// Len returns length of this LTable without using __len.
50func (tb *LTable) Len() int {
51 if tb.array == nil {
52 return 0
53 }
54 var prev LValue = LNil
55 for i := len(tb.array) - 1; i >= 0; i-- {
56 v := tb.array[i]
57 if prev == LNil && v != LNil {
58 return i + 1
59 }
60 prev = v
61 }
62 return 0
63}
64
65// Append appends a given LValue to this LTable.
66func (tb *LTable) Append(value LValue) {

Callers 12

TestTableLenFunction · 0.45
TestTableAppendFunction · 0.45
TestTableInsertFunction · 0.45
baseUnpackFunction · 0.45
initFunction · 0.45
tableGetNFunction · 0.45
tableConcatFunction · 0.45
ObjLenMethod · 0.45
ObjLenMethod · 0.45
TestObjLenFunction · 0.45
channelSelectFunction · 0.45
dumpFunction · 0.45

Calls

no outgoing calls

Tested by 4

TestTableLenFunction · 0.36
TestTableAppendFunction · 0.36
TestTableInsertFunction · 0.36
TestObjLenFunction · 0.36