lua-users home
lua-l archive

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


On Fri, Dec 14, 2012 at 2:01 PM, Michal Kottman <k0mpjut0r@gmail.com> wrote:
> 1) we have a table and want to add/override fields from another table -
> borrowing from jQuery, let's call it extend
> 2) merge all fields into a new table - easily implemented using the first
> Since the functions are so short, maybe they deserve the inclusion into
> Microlight? Or has the "top 30" limit been already reached? :)

(1) already exists in Microlight as import  (for map-like) and extend
(for list-like), although they don't take n tables.

import() is one of those strangely named - one of its jobs is to pull
a module's functions into a convenient namespace. (Still think it
_should_ be called update as in Python)

Making these guys work with n-tables is a good idea, although my
over-optimizing side worries about the table creation needed to access
varargs. The solution there, of course, is to optimize the two-table
case and only fall back to the loop for n > 2

Illustrates an entertaining property of Lua libraries - even their
authors can't always remember their whole functionality ;)

steve d.