lua-users home
lua-l archive

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


On Thu, 29 Jun 2017 15:01:00 +0100
 Javier Guerra Giraldez <javier@guerrag.com> wrote:
On 29 June 2017 at 14:09,  <temp212@gorodok.net> wrote:
BUT, the problem is there is no way to set it as metatable to newly created
tables automatically

function m(t)
   return setmetatable(t, mathematicmetatable)
end

m{x,y,z} * m{1, 0, 1} +  5

--
Javier

Thanks Javier, this would work, but additional letter before table still looks a little bit ugly to me, although not as ugly as my patch that from internals gets the default metatable using C api.

In some older Lua versions, according to few messages in mailing list from about 15 years ago, it looks like there was some default metatable, why its gone?

---
Pavel