Using table.length as an alias for table.getn only works for array tables. I need to support both. For efficiency, start by attempting to get length using #t, which will return 0 if not an array. In the case that #t is 0, perform the less efficient loop to calculate the length.
Using
table.length
as an alias fortable.getn
only works for array tables. I need to support both. For efficiency, start by attempting to get length using#t
, which will return 0 if not an array. In the case that#t
is 0, perform the less efficient loop to calculate the length.