Numbers are buggy?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Numbers are buggy?

Soni "They/Them" L.
$ lua
Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
 > foo=1print(foo)
1
 > a=1f()
stdin:1: malformed number near '1f'
 > a=1g()
stdin:1: attempt to call a nil value (global 'g')
stack traceback:
     stdin:1: in main chunk
     [C]: in ?
 >

This seems to exist since the introduction of hex literals (Lua 5.2).
Not sure of the exact revision.

Reply | Threaded
Open this post in threaded view
|

Re: Numbers are buggy?

Soni "They/Them" L.


On 2019-04-08 12:51 p.m., Soni "They/Them" L. wrote:

> $ lua
> Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
> > foo=1print(foo)
> 1
> > a=1f()
> stdin:1: malformed number near '1f'
> > a=1g()
> stdin:1: attempt to call a nil value (global 'g')
> stack traceback:
>     stdin:1: in main chunk
>     [C]: in ?
> >
>
> This seems to exist since the introduction of hex literals (Lua 5.2).
> Not sure of the exact revision.

Sorry, I mean since the introduction of hex fractional parts and binary
exponents.

Reply | Threaded
Open this post in threaded view
|

Re: Numbers are buggy?

Luiz Henrique de Figueiredo
In reply to this post by Soni "They/Them" L.
> This seems to exist since the introduction of hex literals (Lua 5.2).

This exists since Lua 5.1.

Reply | Threaded
Open this post in threaded view
|

Re: Numbers are buggy?

Soni "They/Them" L.


On 2019-04-08 1:32 p.m., Luiz Henrique de Figueiredo wrote:
>> This seems to exist since the introduction of hex literals (Lua 5.2).
> This exists since Lua 5.1.
>

I noticed :) (accidentally confused hex literals with hex escapes, sorry)

However:

$ lua5.1
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
 > a=1print(a)
stdin:1: malformed number near '1print'

Reply | Threaded
Open this post in threaded view
|

Re: Numbers are buggy?

Roberto Ierusalimschy
> However:
>
> $ lua5.1
> Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> > a=1print(a)
> stdin:1: malformed number near '1print'

The weirdness is that 5.3 accepts that, not the other way around.

-- Roberto