#how to make so when i overwrite __newindex function it still saves the value
1 messages · Page 1 of 1 (latest)
@zenith badge You want to use rawset
It takes the table, key, and value
so in your case it would be:
local DataManager = {}
local Metatable = {
__index = DataManager,
__newindex = function(Table, Key, Value)
rawset(Table, Key, Value) --This sets the value!
if DataManager[Key] ~= Value then
print("changed")
end
end
}
DataManager.Profiles = setmetatable({},Metatable)
return DataManager