[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: About the #(length) operator and table.getn
- From: Petite Abeille <petite.abeille@...>
- Date: Tue, 25 Mar 2008 19:45:43 +0100
On Mar 25, 2008, at 7:09 PM, RJP Computing wrote:
I like the idea of using foreach, but only if it is going to be in
Lua for many versions to
come.
Don't let that stop you! Write your own!
local function ForEach( aTable, aFunction )
for aKey, aValue in pairs( aTable ) do
aFunction( aKey, aValue )
end
end
ForEach( { a = 1, b = 2, c = 3 }, print )
> a 1
> c 3
> b 2
Or something!