lua-users home
lua-l archive

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


> Lua 5.2.0  Copyright (C) 1994-2011 Lua.org, PUC-Rio
>> return string.format("%d", 2.5)
> stdin:1: bad argument #2 to 'format' (not an integer in proper range)
> stack traceback:
>        [C]: in function 'format'
>        stdin:1: in main chunk
>        [C]: in ?

It's the old tradeoff — which deserves helpful behaviour more: an
error because something that should be an integer isn't, or untidy but
not incorrect programming?

I lean towards the former.  It might alert the user to dep lurking bugs.

Dirk