[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: for
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Fri, 20 Aug 1999 00:14:06 -0300 (EST)
>From lua-l@tecgraf.puc-rio.br Thu Aug 19 21:53:29 1999
>From: Steve Dekorte <steve@dekorte.com>
>Lua:
>
> add_ = function (self, num)
> local index, item = next(self.list(), nil)
> while index
> item.add_(num)
> index, item = next(self.list(), nil)
> end
> end
>
>
>Lua with for:
>
> add_ = function (self, num)
> for item in self.list():
> item.add_(num)
> end
> end
Something very close to this can be done already:
add_ = function (self, num)
foreach(self.list(),function (item) item.add_(%num) end)
end
--lhf