lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> After some testing and the help of a friend, it turns out that it isn't an issue with the addition at all, but rather that string.rep() decides to return an empty string:
> 
> print("\""..string.rep("1+", 1e50).."\"");
> Output: ""

The problem is that string.rep uses an int to count the number of repetitions
and 1e50 does not fit into an integer. In one Linux machine I tested it, 1e+50
became -981572454 and so string.rep does no repetition at all, hence the empty
string. You don't need to go to 1e50; 1e12 suffices for 32-bit ints.