Ok i'm kinda bad at this so i'll explain by giving a simple example first:
Say i have a "class", lets name it MyClass, lets say it has a function named MyFunction, we can access this by calling the function from any MyClass objects like MyClassObject:MyFunction().
If i didn't have access to that function, and wanted to add a new behaviour that executes beforehand, i can do something like:
MyClass.OriginalMyFunction = MyClass.MyFunction -- store old function
function MyClass:MyFunction(args)
--Do something beforehand
MyClass:OriginalMyFunction(args) --call original function with same args
end
This was just a simple example, but what i need is doing the same for all possible functions in a class. As in calling any functions on MyClassObject should execute some code before executing that function.
Is this possible? If so, how do i do it?