我想知道是否有任何方法可以逃避 __metatable 元方法。我知道没有,但我正在尝试做这样的事情,但显然 __metatable 阻止了这种情况的发生:
-- pretend that there is a __metatable field given to a table
setmetatable(_G, {__index = {None="No indexes"}})
-- error: (the string given to the __metatable metamethod)
我在这里要做的只是逃避 __metatable 字段,并简单地允许自己在 _G 上设置一个元表,它已经有一个。我知道这样做是不可能的,但是我想问一下还有没有机会绕过?