Thanks from idea @SamuraiCrow
It seems like that could work as I am wanting program execution wise, going to think about it a bit whether it makes the code too messy to read or not, as my main purpose is to find a solution that would keep the code reading as clean as possible, hence would like a solution where I only need to add lines to the end of the code. That everything looks normal until you reach the point the debug parts start.
I was able to figure out this a bit forward, the self part is still a problem for me.
Code: Select all
Function func(var)
DebugPrint(var)
EndFunction
debug1 = func
Function func(var)
DebugPrint("func("..var..")")
debug1(var)
EndFunction
func("test")
This one works as expected. Or rather bit unexpected, since I would have actually expected this to end into infinite recursion, but it actually doesn't, and I am not even sure why, since it would make sense if Hollywood just made a copy of that function when using "newfunc = oldfunc", but actually it seems to be a reference since if I now change debug1 into something else, it will also reflect to new "func(var)" function.
@Andreas is this a bug that it doesn't end in endless recursion, or supposed to work this way, and Why? For shouldn't new "func(var)" first refer to debug1, which in turn refers to "func(var)" again, ending into endless recursion?
using SELF is still a problem, I tried like this:
Code: Select all
funcs = { var = 1}
Function funcs:func(var)
DebugPrint(var)
DebugPrint(self.var)
EndFunction
test = {}
test.test = funcs.func
Function funcs:func(var)
DebugPrint("funcs:func()")
test:test(var)
EndFunction
funcs:func("test")
And it works otherwise, except it is not able to reference to self.var, which is otherwise bit off, except when considering that the previous one doesnt get to endless recursion, reason is probably on that same reason.