[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: numeric captures (string.find)
- From: Asko Kauppi <asko.kauppi@...>
- Date: Wed, 15 Sep 2004 00:59:16 +0300
No, it doesn't..
if a==42 then
But I see your point; sometimes it does.
Also, if the number is used as a key to table, there's no implicit
conversion. Such bugs are tedious and hard to find.
15.9.2004 kello 01:49, David Given kirjoitti:
Asko Kauppi wrote:
Would it be hard to make 'string.find()' return true numbers (not
strings with numerical contents, as now):
local _,_, a,b= string.find( "42 world", "(%d+)%s+(.+)" )
I believe this little change would be welcome, and not cause major
headaches in applications (they now have 'tonumber()', which would
become irrelevant but work the same).
Why do you need it? Lua will implicitly convert the numbers as needed.
a = "42"
print(a + 1)
[insert interesting .sig here]