Skip to content

Commit 3ff3cc9

Browse files
committed
use single underscore for unsaved class members
this also fixes unsaved members not cloning into entity on instantiation
1 parent 4539c67 commit 3ff3cc9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/vscripts/alyxlib/class.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ local function _inherit(base, self, fenv)
133133
}
134134
-- Used to automatically save values
135135
meta.__newindex = function(table, key, value)
136-
if not key:startswith("__") and type(value) ~= "function" then
136+
if not key:startswith("_") and type(value) ~= "function" then
137137
meta.__values[key] = value
138138
self:Save(key, value)
139139
else
@@ -464,7 +464,7 @@ function EntityClass:Save(name, value)
464464
Storage.Save(self, name, value~=nil and value or self[name])
465465
end
466466
for key, val in pairs(self) do
467-
if not key:startswith("__") and type(val) ~= "function" then
467+
if not key:startswith("_") and type(val) ~= "function" then
468468
Storage.Save(self, key, val)
469469
end
470470
end

0 commit comments

Comments
 (0)