lua-users home
lua-l archive

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


On Tue, Mar 25, 2008 at 2:45 PM, Petite Abeille <petite.abeille@gmail.com> wrote:
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!

Very cool. Great idea. Of coarse. Thanks for such a simple solution.
--
Regards,
Ryan