lua-users home
lua-l archive

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

> Maybe related, or not:
>    print(string.format("%s", true))
> ==>
>    Error: xyz.lua:192: bad argument #2 to 'format' (string expected, got boolean)
> _Sometimes_, in some program files (and the same with other
> non-string and non-number types).
> (This is why I was so surprised when, in a previous thread, Luiz H.
> de Figueiredo just stepped it to note it's right what format now
> does in 5.2 (auto-convert to string). I then checked in a test file,
> and it worked like a charm. But I knew I had had these errors
> precisely, reason of my to wrap that into a printf and worrying.
> These same errors now come back in different files of 2 different
> projects. And again I have checked I don't modify by error any
> builtin func or "type-table".)

Indeed, it seems quite related. Again, it looks like you are using Lua
5.1 instead of Lua 5.2:

Lua 5.1.4  Copyright (C) 1994-2008, PUC-Rio
> print(string.format("%s", true))
stdin:1: bad argument #2 to 'format' (string expected, got boolean)

Lua 5.2.1  Copyright (C) 1994-2012, PUC-Rio
> print(string.format("%s", true))

-- Roberto