2024-03-06 18:04:49 +01:00
|
|
|
-- Registered metatables, used by the C++ packer
|
|
|
|
local known_metatables = {}
|
2024-08-02 00:13:25 +02:00
|
|
|
function core.register_portable_metatable(name, mt)
|
2024-03-06 18:04:49 +01:00
|
|
|
assert(type(name) == "string", ("attempt to use %s value as metatable name"):format(type(name)))
|
|
|
|
assert(type(mt) == "table", ("attempt to register a %s value as metatable"):format(type(mt)))
|
|
|
|
assert(known_metatables[name] == nil or known_metatables[name] == mt,
|
|
|
|
("attempt to override metatable %s"):format(name))
|
|
|
|
known_metatables[name] = mt
|
|
|
|
known_metatables[mt] = name
|
|
|
|
end
|
|
|
|
core.known_metatables = known_metatables
|
|
|
|
|
2024-08-02 00:13:25 +02:00
|
|
|
function core.register_async_metatable(...)
|
2024-10-28 19:40:18 +01:00
|
|
|
core.log("deprecated", "core.register_async_metatable is deprecated. " ..
|
|
|
|
"Use core.register_portable_metatable instead.")
|
2024-08-02 00:13:25 +02:00
|
|
|
return core.register_portable_metatable(...)
|
|
|
|
end
|
|
|
|
|
|
|
|
core.register_portable_metatable("__builtin:vector", vector.metatable)
|