@rbxts/jsnatives



mimics the Array.isArray function from javascript

in lua side it checks if element is a table and if the table has a non-zero length or if next(table) returns something, otherwise table is not considered to be an array.

const a = [1, 2, 3];
print(Object.isArray(a)); // true

const a = {};
print(Object.isArray(a)); // false

const a = {1: 1};
print(Object.isArray(a)); // false

Works with proxies

const a = new Proxy([1, 2, 3], {});
print(Object.isArray(a)); // true

Proxies with len hook returning non 0 will return true

const a = new Proxy({}, {
len: () => {
return 3;
}
});
print(Object.isArray(a)); // true