[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Mixing strings and numbers
- From: Gavin Wraith <gavin@...>
- Date: Thu, 14 Dec 2006 23:05:44 GMT
In message <369646.36347.qm@web81609.mail.mud.yahoo.com> you wrote:
> I have a problem with Lua code that I am generating
> from an existing scripting language that has no notion
> of type checking. The problem is in code like this:
>
> if X ~= "" or X == 0 then X = 3 end
>
> Obviously this isn't going to be legal in Lua, since X
> cannot be both a string and a number at the same time.
It does not have to be. The code is quite legal. Check it out.
Try
print ( "type abuse is disgusting" == 2006 )
at the lua prompt, to convince yourself.
--
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/