lua-users home
lua-l archive

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


At 18:05 11/08/2003 -0400, you wrote:
Hi guys,

hi.
>> f = function() return 1,99 end
> x = 2 or f()
> print(x)
>2
[...]
> _,x = _,nil or f()
> print(x)              -- x = 1 !!!
1

Shouldn't be 99?

I think the problem is that f() is returning 2 values, but you alredy have a first value on the right ('_'), so 99 is the 3rd.. like this:

_,x = _,1,99

(I just replaced with the result of 'nil or f()'). The list on the right gets adjusted, and the 99 is thrown away.

good luck with the regexp :)

bye..

Ariel.


Ariel.
http://Anime.com.ar
snm