StoryWeaver
December 13th, 2019, 20:02
I'm trying to figure out how to call an original function later in the code, that has been overriden/redirected in the onInit() function.
The onInit looks as follows:
function onInit()
EffectManager.addEffect = addEffectDuplicateCheck;
end
Then in the overridden function after some functionality has taken place, I then want to call the original function again, given certain conditions.
Such as in addEffectDuplicateCheck:
if (bFoundDuplicate == false) then
EffectManager.addEffect = EffectManager.addEffect; -- attempt at redirecting function back to its original
EffectManager.addEffect(sUser, sIdentity, nodeCT, rNewEffect, bShowMsg);
end
The problem I'm having is that I'm not sure how to call the original EffectManager function again, after the custom code has ran.
Currently this functionality will put FG into and endless loop, as the function is calling itself continually.
Is there a way to do this?
I'd rather not copy the about 90 lines of code from the original EffectsManager.addEffect function, and rewrite it to work in the new .lua.
As that would be rather messy coding and harder to maintain.
The onInit looks as follows:
function onInit()
EffectManager.addEffect = addEffectDuplicateCheck;
end
Then in the overridden function after some functionality has taken place, I then want to call the original function again, given certain conditions.
Such as in addEffectDuplicateCheck:
if (bFoundDuplicate == false) then
EffectManager.addEffect = EffectManager.addEffect; -- attempt at redirecting function back to its original
EffectManager.addEffect(sUser, sIdentity, nodeCT, rNewEffect, bShowMsg);
end
The problem I'm having is that I'm not sure how to call the original EffectManager function again, after the custom code has ran.
Currently this functionality will put FG into and endless loop, as the function is calling itself continually.
Is there a way to do this?
I'd rather not copy the about 90 lines of code from the original EffectsManager.addEffect function, and rewrite it to work in the new .lua.
As that would be rather messy coding and harder to maintain.