MaxN returns a maximum number key that nil value does not exist before it.
()
| 104 | |
| 105 | // MaxN returns a maximum number key that nil value does not exist before it. |
| 106 | func (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. |
| 119 | func (tb *LTable) Remove(pos int) LValue { |
no outgoing calls