lua-users home
lua-l archive

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


It also occurs to me that table.move allows for a hackish map implementation.

function table.map(self, func)
    table.move(setmetatable({}, {
      __index = self,
      __newindex = function(t,k,v) self[k] = func(v) end
    }), 1,#self,1)
end

-- 
tom <telliamed@whoopdedo.org>