[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Question on get/setmetatable()
- From: Andrea <andrea.l.vitali@...>
- Date: Fri, 15 May 2020 20:20:22 -0700
Why get/setmetatable() are necessary?
One could simply set a special key such as __metatable by writing something like
mt = {}
t = {}
t.__metatable = mt
Instead of writing
setmetatable(t,mt)
And similarly for getmetatable()
So what is the reason to keep these functions?
This question is born from looking at the language evolution: there were set/getfenv() and now there is just a special __ENV
Andrea
--
_______________________________________________
lua-l mailing list -- lua-l@lists.lua.org
To unsubscribe send an email to lua-l-leave@lists.lua.org