How to run code if a property is changed?

I think I understand what youre asking and why what I originally said was wrong
Consider the following example:

local class = {}
class.__index = class

function class.new(enabled)
    local newclass = {}
    setmetatable(newclass,class)

    newclass.Enabled = enabled

    local buffer = {}
    setmetatable(buffer,{__index = function(_,key)
        if key == "Enabled" then
            print("Enabled has been indexed!")
        end
        return newclass[key]
    end;
    __newindex = function(_,key,value)
        newclass[key] = value
    end;
    })

    return buffer
end

function class.foo()
    return "bar"
end

local instance = class.new(false)

print(instance["Enabled"])

print(instance.Enabled)
instance.Enabled = true
print(instance.Enabled)
instance.Enabled = false
print(instance.Enabled)
print(instance.foo())

→ Enabled has been indexed!
→ false
→ Enabled has been indexed!
→ true
→ bar

I really dont know much about metamethods but I think a buffer table would be your best bet in this case