Skip to content

Commit

Permalink
refactor(client/imports): extra backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
thelindat committed Mar 1, 2024
1 parent 31265b4 commit 73903cc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions imports/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ local Ox = require '@ox_core.lib.client.init'

---@deprecated
player = setmetatable({}, {
__index = function(self, index) return index == 'groups' and Ox.GetPlayer().getGroups() or Ox.GetPlayer()[index] end,
__newindex = function(self, index, value) Ox.GetPlayer()[index] = value end,
__index = function(_, index)
local player = Ox.GetPlayer()

if index == 'groups' then return player.getGroups() end

return player[index] or player.get(index)
end,
__newindex = function(_, index, value) Ox.GetPlayer()[index] = value end,
})

return Ox

0 comments on commit 73903cc

Please sign in to comment.