lua-users home
lua-l archive

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


> I've always wanted a "(%d+)" caption to give me a number, not a string.

It would sometimes be convenient, agreed. But the string may not always fit
as a number. For instance, my programs have to deal with mobile phone IMEI
numbers - 15 digits, and a loss of precision would be a real problem with
those!

You also lose any leading zeros.

P.

-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Asko Kauppi
Sent: 09 September 2006 09:30
To: Lua list
Subject: Re: Patch to remove auto-casting between numbers and strings


Perhaps having to do with this:

 > _,_,a= string.find( "100", "(%d+)" )
 > print(type(a))
string

I've always wanted a "(%d+)" caption to give me a number, not a string.

-asko


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.2/442 - Release Date: 08/09/2006