Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace debug.getregistry with FindMetaTable #3

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lua/entities/gmod_wire_expression2/core/e2lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ hook.Add("InitPostEntity", "e2lib", function()

-- check for a CPPI compliant plugin
if SERVER and CPPI then
if debug.getregistry().Player.CPPIGetFriends then
if FindMetaTable("Player").CPPIGetFriends then
E2Lib.replace_function("isFriend", function(owner, player)
if owner == nil then return false end
if owner == player then return true end
Expand All @@ -934,7 +934,7 @@ hook.Add("InitPostEntity", "e2lib", function()
end)
end

if debug.getregistry().Entity.CPPIGetOwner then
if FindMetaTable("Entity").CPPIGetOwner then
local _getOwner = E2Lib.getOwner
E2Lib.replace_function("getOwner", function(self, entity)
if not IsValid(entity) then return end
Expand Down Expand Up @@ -1258,4 +1258,4 @@ function E2Lib.compileScript(code, owner)
end
end
end
end
end
2 changes: 1 addition & 1 deletion lua/entities/gmod_wire_expression2/core/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ end

__e2setcost(2)

if CPPI and debug.getregistry().Player.CPPIGetFriends then
if CPPI and FindMetaTable("Player").CPPIGetFriends then

local function Trusts(ply, whom)
if ply == whom then return true end
Expand Down
Loading