(v value)
| 69 | } |
| 70 | |
| 71 | func (l *State) objectLength(v value) value { |
| 72 | var tm value |
| 73 | switch v := v.(type) { |
| 74 | case *table: |
| 75 | if tm = l.fastTagMethod(v.metaTable, tmLen); tm == nil { |
| 76 | return float64(v.length()) |
| 77 | } |
| 78 | case string: |
| 79 | return float64(len(v)) |
| 80 | default: |
| 81 | if tm = l.tagMethodByObject(v, tmLen); tm == nil { |
| 82 | l.typeError(v, "get length of") |
| 83 | } |
| 84 | } |
| 85 | return l.callTagMethod(tm, v, v) |
| 86 | } |
| 87 | |
| 88 | func (l *State) equalTagMethod(mt1, mt2 *table, event tm) value { |
| 89 | if tm1 := l.fastTagMethod(mt1, event); tm1 == nil { // no metamethod |
no test coverage detected