From 75f4ecbbea04c30dac3947e54a7bbc8187835521 Mon Sep 17 00:00:00 2001 From: deFuzz <71142228+deFuzz77@users.noreply.github.com> Date: Sun, 28 Apr 2024 04:08:15 +0200 Subject: [PATCH] fix(class): fixed private access in method calls (#553) Co-authored-by: Linden <65407488+thelindat@users.noreply.github.com> --- imports/class/shared.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imports/class/shared.lua b/imports/class/shared.lua index 1fed090..498bdd6 100644 --- a/imports/class/shared.lua +++ b/imports/class/shared.lua @@ -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