Embed Notice
HTML Code
Corresponding Notice
- Embed this notice
gwemprine (gwenprime@www.librepunk.club)'s status on Friday, 19-Jan-2024 13:26:08 JSTgwemprine x = {
__type = 'number',
}
y = setmetatable({}, x)
print(type(y)) -- 'table'
_G.old_type = type
type = function(target)
local mt = getmetatable(target)
if mt and mt.__type and type(mt.__type) == 'string' then
return mt.__type
end
return old_type(target)
end
print(type(y)) -- 'number'