Functions overriden twice
Hi I am trying to correclty save old references and call them in overridden functions however I get some sort of recursion:
Code:
function onInit()
-- save the old ref
oldRef = SomeModule.SomeFunction;
-- replace the function reference with new code
SomeModule.SomeFunction= new_function;
end
function new_function()
Debug.chat("1")
oldRef()
end
whenever SomeModule.SomeFunction gets called I get "1" twice in the chat (and the function is executed twice)
however if I "hard" override the function e.g.
Code:
function onInit()
-- replace the function reference with new code
SomeModule.SomeFunction= new_function;
end
function new_function()
Debug.chat("1")
-- <just copy paste the old code here>
end
I only get "1" once in the chat and the function in only executed once.
What could this be?