lua-users home
lua-l archive

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


On Mon, 2019-06-24 at 19:16 +0200, Viacheslav Usov wrote:
> I do not think the problem is addressed in the manual (__metatable
> is, in my opinion, not mentioned where it should, nor is its purpose
> stressed at all). With the sample code in PiL and well-known Lua
> libraries having this problem as illustrated above, we seem to have a
> well-established unsafe paradigm and the question is how we can get
> out of this trouble.
> 
> Cheers,
> V.

`userdata` object is somewhat "foreign" for Lua: no default operations
can be applied to it: no addition/subtraction/indexing/etc. I
personally think that would make perfect sense to disable its
modification with `getmetatable`/`setmetatable` (keep debug. versions
functional of course), as it isn't Lua-side code business to manage its
internal state (and metatables are part of its internal state).

-- 
v <v19930312@gmail.com>