[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: string.format a nil value
- From: Diego Nehab <diego@...>
- Date: Thu, 24 Aug 2006 04:37:50 -0400 (EDT)
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.