Skip to main content

rawlen

Function rawlen 

Source
pub fn rawlen<T: length>(v: T) -> number
Expand description

Returns the length of the object v, which must be a table or a string, without invoking the __len metamethod.

§Examples

local t = setmetatable({1, 2, 3}, { __len = function() return 42 end })
print(#t)          --> 42
print(rawlen(t))   --> 3
print(rawlen("hello"))   --> 5