I'm not sure exactly what you're asking, so this is spun a few ways.

2^54 = 18,014,398,509,481,984 is the end of the line.

Internally, Lua uses numbers that are interpolations between powers of 2, namely 1 / 2^53 of the distance from one to the other. As you can imagine, this gives you a pretty huge swath between 1 / 4, 1 / 2, 1, 2, 4, 8, 16, ... etc.

Once you hit 2^53, though, it means you land exactly on all the integers and can't represent any values in between.

Once you hit 2^54, you can't even land on odd integers (then only multiples of 4, then 8, and so on), thus the problem. In fact, if you increment by 1, you won't move at all. This is exactly the same phenomenon as the "I gave it THESE decimal values but it's printing THESE slightly different ones" issue that sometimes shows up on the forums: the numbers aren't exactly representable.

That's me interpreting your question "How can I work with huge numbers" one way, to say you actually have more than you might think.

You actually can use 1.65e11 directly in Lua, in case you were wondering that.

With the "e" and "E" specifiers to **string.format()** you can get the scientific format:

print("!!!", string.format("%e", 3323473.4534532))
print("???", string.format("%E", 343439054398509435))