Maximum Luau integer value for a table index?

Hey Guys,

Just wondering what the maximum integer value is in luau?
I’ve tested the following

local test = {}

test[2147483647] =3
test[2147483647000] = 4

print("1: ", test[2147483647])       -- prints 3

print("2: ", test[2147483647000])    -- prints 4

I’m wanting to store the UserId of players as an index value in a table, so I need to be sure that I can use an index value higher than 2147483647.

I don’t believe there is one, this may have to do with the fact you can index a table with just about anything.

Ex:

local t = {};
t[math.huge] = 5;
t[workspace.Terrain] = "hello";

print(t[workspace.Terrain]) --> "hello"
print(t[math.huge]) --> 5
2 Likes

Excellent, Thank you very much.

1 Like