lua-users home
lua-l archive

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

Den 2012-12-14 07:19, skrev Dirk Laurie:
merge(...): returns a new table containing all the pairs from all the
    tables given as arguments. In particular, if there is only one argument,
    returns a shallow copy. In case of duplicate keys, later values
    replace earlier ones. Nil arguments are treated as empty tables.

The documentation is much longer than the code!

I like it. Simple, generic, works for both array-like and dict-like tables.

Maybe also merge_rev(...) : Processing (...) backwards, giving precedence to earlier tables in (...) .