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