[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: for
- From: Steve Dekorte <steve@...>
- Date: Thu, 19 Aug 1999 17:47:03 -0700
Is anyone else interested in adding a python-like "for" statement to lua?
Check out this example:
Python:
def add_(self, num):
for item in self.list():
item.add_(num)
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