Fixed some types not being able to be registered when they actually should

This commit is contained in:
EvilFactory
2023-04-12 12:45:06 -03:00
parent aa0be735f9
commit 1186719e62

View File

@@ -23,7 +23,7 @@ end
local originalRegisterType = LuaUserData.RegisterType
LuaUserData.RegisterType = function (typeName)
if not IsAllowed(typeName) then
if not LuaUserData.IsRegistered(typeName) and not IsAllowed(typeName) then
error("Couldn't register type " .. typeName .. ".", 2)
end
@@ -38,8 +38,8 @@ end
local originalCreateStatic = LuaUserData.CreateStatic
LuaUserData.CreateStatic = function (typeName, addCallMethod)
if not IsAllowed(typeName) then
error("Couldn't register type " .. typeName .. ".", 2)
if not LuaUserData.IsRegistered(typeName) and not IsAllowed(typeName) then
error("Couldn't create static type " .. typeName .. ".", 2)
end
local success, result = pcall(originalCreateStatic, typeName, addCallMethod)