lua-users home
lua-l archive

Re: what's wrong with this loop syntax?

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


Rafael,
Your code doesn't work either. But the following code works, although more clumsy than what I first tried:
 while true do
 str = S:Next()
 if str == nil then break end
 -- stuff
 end
So do you have any idea why I cannot use the more compact syntax that I first trieed?
Michael
----- Original Message ----- From: "Rafael de Menezes" <soscpd@terra.com.br>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Monday, January 08, 2007 1:47 PM
Subject: Re: what's wrong with this loop syntax?
Just while (str) do
if str = S:Next() then
end
end
doesnt work? Its not the beeest est code, but i dont have more sources.... ----- Original Message ----- From: "Michael Newberry" <mnewberry@mirametrics.com>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Monday, January 08, 2007 6:33 PM
Subject: what's wrong with this loop syntax?
Pardon me for asking a simple question, but why can't I use this syntax?
 while (str = S:Next()) ~= nil do
or this syntax:
 while (str = S:Next()) and str ~= nil do
where S exists and S:Next() returns a string or nil.
I get this message: `)' expected near `='
Thanks,
Michael

AltStyle によって変換されたページ (->オリジナル) /