Posted 03 August 2014 - 10:26 AM
Hi everyone!
Because require function is not available, what is the best way to do the same thing?
I have several files (A, B, C …) which declare functions (A.a1, A.a2 in A…) and in each file I need functions in other files (A.a1 can call B.b1), knowing that sometime I redefined functions of another file (in C I can write B.b1 = C.c1).
Finally, I have a main file which load all of this files (And I expect than B.b1 call C.c1 if I load C or I load a file which load C).
Currently I use os.loadAPI, but files are loaded several times so I can not redefined functions (only in the file after the redefinition if I have understood my problem). os.loadAPI is not the good alternative to require function? I do not use it correctly?
Also, I redefined this function to avoid this by register all API already loaded, but if Main need A and B, and A need B, when I execute Main, it load A so B is load by A, and when Main try to load again B nothing happen because B was already loaded by A (expected behavior), but in Main I have no access to B functions. A do not place them in the global variable? What is the right way to do?
Because require function is not available, what is the best way to do the same thing?
I have several files (A, B, C …) which declare functions (A.a1, A.a2 in A…) and in each file I need functions in other files (A.a1 can call B.b1), knowing that sometime I redefined functions of another file (in C I can write B.b1 = C.c1).
Finally, I have a main file which load all of this files (And I expect than B.b1 call C.c1 if I load C or I load a file which load C).
Currently I use os.loadAPI, but files are loaded several times so I can not redefined functions (only in the file after the redefinition if I have understood my problem). os.loadAPI is not the good alternative to require function? I do not use it correctly?
Also, I redefined this function to avoid this by register all API already loaded, but if Main need A and B, and A need B, when I execute Main, it load A so B is load by A, and when Main try to load again B nothing happen because B was already loaded by A (expected behavior), but in Main I have no access to B functions. A do not place them in the global variable? What is the right way to do?