lua-users home
lua-l archive

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


Luiz, OK, thanks. Is there any way to make it more compact (and more readable to me, at least), where the loop is tested at the top of the loop? Here is what I use:

   while true do
       str = S:Next()
       if str == nil then break end
       -- [code]
   end


Michael

----- Original Message ----- From: "Luiz Henrique de Figueiredo" <lhf@tecgraf.puc-rio.br>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Monday, January 08, 2007 2:15 PM
Subject: Re: what's wrong with this loop syntax?


So do you have any idea why I cannot use the more compact syntax that I
first trieed?

An assignment in Lua is not an expression, it's a statement.
See http://www.lua.org/manual/5.1/manual.html#2.4.3 and
http://www.lua.org/manual/5.1/manual.html#8

If assignment were an expression, what would be an interpretation for multiple
assignment?

--lhf