lua-users home
lua-l archive

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


> I have this:
> 
> x = tostring(math.huge)
> print(string.format("%f", x))
> 
> Reference manuals for both 5.1 and 5.2 say that option f expects a number.
> However, 5.1 prints 'inf' and 5.2 breaks with:
> 
> stdin:1: bad argument #2 to 'format' (number expected, got string)
> stack traceback:
>         [C]: in function 'format'
>         stdin:1: in main chunk
>         [C]: in ?
> 
> If I use something like x="foo", both break.
> 
> Is this expected?

Yes. Lua 5.2 is a little more choosy about what its string.format accepts.

-- Roberto