Thanks for the suggestion SilverWizard, but I am using the code in a module and it will be very ugly to use a character to do that, plus i don't know if it will work.
There is an easier and a tad less ugly workaround for this that uses only the module code.
function b() {
... some stuff before c ...
c();
... some stuff after c ...
}
function c() {
... some stuff before b ...
b();
... some stuff after b ...
}
can be done like this:
function stuffbeforeb()
{
... some stuff before b ...
}
function stuffafterb()
{
... some stuff after b ...
}
function b() {
... some stuff before c ...
stuffbeforeb(); \
b(); } This simulates function c()
stuffafterb() /
... some stuff after c ...
}
function c() {
stuffbeforeb();
b();
stuffafterb()
}
This way it works and the code duplication is reduced to a minimum.
And I did a check and recursive functions (functions that call themseves) work just fine in AGS.
Mishel.
There is an easier and a tad less ugly workaround for this that uses only the module code.
function b() {
... some stuff before c ...
c();
... some stuff after c ...
}
function c() {
... some stuff before b ...
b();
... some stuff after b ...
}
can be done like this:
function stuffbeforeb()
{
... some stuff before b ...
}
function stuffafterb()
{
... some stuff after b ...
}
function b() {
... some stuff before c ...
stuffbeforeb(); \
b(); } This simulates function c()
stuffafterb() /
... some stuff after c ...
}
function c() {
stuffbeforeb();
b();
stuffafterb()
}
This way it works and the code duplication is reduced to a minimum.
And I did a check and recursive functions (functions that call themseves) work just fine in AGS.
Mishel.