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

Method RawLength

lua.go:813–823  ·  view source on GitHub ↗

RawLength returns the length of the value at index. For strings, this is the length. For tables, this is the result of the # operator with no metamethods. For userdata, this is the size of the block of memory allocated for the userdata (not implemented yet). For other values, it is 0. http://www

(index int)

Source from the content-addressed store, hash-verified

811//
812// http://www.lua.org/manual/5.2/manual.html#lua_rawlen
813func (l *State) RawLength(index int) int {
814 switch v := l.indexToValue(index).(type) {
815 case string:
816 return len(v)
817 // case *userData:
818 // return reflect.Sizeof(v.data)
819 case *table:
820 return v.length()
821 }
822 return 0
823}
824
825// ToGoFunction converts a value at index into a Go function. That value
826// must be a Go function, otherwise it returns nil.

Callers 1

base.goFile · 0.80

Calls 2

indexToValueMethod · 0.95
lengthMethod · 0.80

Tested by

no test coverage detected