mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-16 22:46:03 +01:00
fix(class): use rawset during instantiation
If classes use a __newindex method it may lead to unexpected behaviour.
This commit is contained in:
@@ -63,17 +63,17 @@ function mixins.new(class, ...)
|
||||
if constructor then
|
||||
local parent = class
|
||||
|
||||
function obj:super(...)
|
||||
rawset(obj, 'super', function(self, ...)
|
||||
parent = getmetatable(parent)
|
||||
constructor = getConstructor(parent)
|
||||
|
||||
if constructor then return constructor(self, ...) end
|
||||
end
|
||||
end)
|
||||
|
||||
constructor(obj, ...)
|
||||
end
|
||||
|
||||
obj.super = nil
|
||||
rawset(obj, 'super', nil)
|
||||
|
||||
if next(obj.private) then
|
||||
local private = table.clone(obj.private)
|
||||
|
||||
Reference in New Issue
Block a user