lua-users home
lua-l archive

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


Hi,

Thank you.
How about producing a empty string?

string.format("Number is %d",data) ==> Number is

I think that passing nil to string.format is more often a
mistake than not. That's why the function throws an error.
When there is no compile-time type checking, run-time type
checking is the best you can do. Otherwise, this type of
error could go unnoticed for much longer.

"%d" is supposed to produce a number.  If you want something
different, then you can use a simple auxiliar function that
uses string.format but that behaves however you like.

Regards,
Diego.