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: ""

So perhaps the question shifts to "shouldn't string.rep() throw an error when faced with an extremely long string, rather than silently returning an empty string?"

Again this problem really shouldn't be faced in the real world, but I have a nasty habit of wanting results to be "correct" instead of them just being usable, even if we don't expect that problem to arise.

Thoughts on this proposal? Surely it can't be hard to implement; there already must be some kind of error checking for string.rep() to return that kind of result.

Thanks,
-- Matthew P. Del Buono a.k.a. Shirik