lua-users home
lua-l archive

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


I like the idea of having a "table-type" default metatable, like for numbers
and strings.
And to set this metatable to "table" library (like for strings).
then things like t = {"one","two","three"}:insert("four"):sort(...) should
work.
patch is here: http://lua-users.org/lists/lua-l/2019-03/msg00080.html

Creating tables with special function that sets the metatable correctly also
fine, but would be nice to have an option to set it once for all the newly
created tables.

function list(t) return setmetatable(t, {__index = table}) end

t = list{"one","two"}:insert(...):




--
Sent from: http://lua.2524044.n2.nabble.com/Lua-l-f2524044.html