lua-users home
lua-l archive

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


--- Glenn Maynard <glenn@zewt.org> wrote:

> On Thu, Dec 14, 2006 at 02:43:24PM -0800, Steve
> Heller 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.
> > Can anyone suggest a way for me to handle this
> > automatically? There are hundreds of these
> statements
> > that need to be maintained while we are converting
> our
> > system from the existing scripting language to
> Lua.
> 
> What do you want, exactly?  The above code is
> completely legal.

It is? I thought a variable had to have a type (at any
given time), and that comparisons had to be to the
correct type. Ok, if that is allowed then I'm in good
shape. Thanks.