lua-users home
lua-l archive

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




On Thu, Jun 18, 2015 at 10:32 AM, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
> > 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)

It already does that on x86 on 5.2.1, but not on sparc. Both are running solaris.