Skip to content

Commit

Permalink
fix(class): fixed private access in method calls (#553)
Browse files Browse the repository at this point in the history
Co-authored-by: Linden <[email protected]>
  • Loading branch information
deFuzz77 and thelindat authored Apr 28, 2024
1 parent 113f522 commit 75f4ecb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions imports/class/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 75f4ecb

Please sign in to comment.