lua-users home
lua-l archive

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


> > I'm relatively new to lua, and I'm wondering if there is a fix for this on
> > 5.2.1:
> >
> > > print(string.format('%d', 2^63))
> > 9223372036854775807 [[ = 2^63 - 1 ]]
> >
> 
> Anybody have a clue why this happens? Doesn't seem to be string.format
> related.

One fix is use Lua 5.2.2 or later, which at least complains:

   Lua 5.2.4  Copyright (C) 1994-2015 Lua.org, PUC-Rio
   > print(string.format('%d', 2^63))
   stdin:1: bad argument #2 to 'format' (not a number in proper range)