mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-16 22:46:03 +01:00
fix(class): fixed private access in method calls (#553)
Co-authored-by: Linden <65407488+thelindat@users.noreply.github.com>
This commit is contained in:
@@ -85,14 +85,14 @@ function mixins.new(class, ...)
|
||||
__index = function(self, index)
|
||||
local di = getinfo(2, 'n')
|
||||
|
||||
if di.namewhat == 'local' then return end
|
||||
if di.namewhat ~= 'method' and di.namewhat ~= '' then return end
|
||||
|
||||
return private[index]
|
||||
end,
|
||||
__newindex = function(self, index, value)
|
||||
local di = getinfo(2, 'n')
|
||||
|
||||
if di.namewhat ~= 'method' then
|
||||
if di.namewhat ~= 'method' and di.namewhat ~= '' then
|
||||
error(("cannot set value of private field '%s'"):format(index), 2)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user