RobertFromDresd
12 years agoOccasional Contributor
Help needed! GlobalVariables in 2 units didnt work
Hi,
I have 2 script units (jscript) and try to use the GlobVariables in both, but it didnt work. I read all helptopics about useunit, runner and related but dont get it.
My setup:
////////////////////////////////////////////////////////////
// MainUnit //
var settingA = setting for A ';
var settingB = 'setting for B';
//USEUNIT SubFunctionsUnit
function mainloop()
{
Log.Message ( 'MainLoop' + settingA );
subfnct( settingB );
}
////////////////////////////////////////////////////////////
// SubFunctionsUnit //
function subfnct( settingB )
{
Log.Message ( 'subfnct SA:' + settingA );
Log.Message ( 'subfnct SB:' + settingB );
}
You see, there are two functions. The MainUnit where i setup all my glob variables and with mainloop() where i control all sub functions to keep track of the scripts process and not get disturbed by all the small action-functions who doing things. But in subfnct() in another script i can not access to settingA.
Hope anyone can help me use global variables :(
Best Regards
Robert
I have 2 script units (jscript) and try to use the GlobVariables in both, but it didnt work. I read all helptopics about useunit, runner and related but dont get it.
My setup:
////////////////////////////////////////////////////////////
// MainUnit //
var settingA = setting for A ';
var settingB = 'setting for B';
//USEUNIT SubFunctionsUnit
function mainloop()
{
Log.Message ( 'MainLoop' + settingA );
subfnct( settingB );
}
////////////////////////////////////////////////////////////
// SubFunctionsUnit //
function subfnct( settingB )
{
Log.Message ( 'subfnct SA:' + settingA );
Log.Message ( 'subfnct SB:' + settingB );
}
You see, there are two functions. The MainUnit where i setup all my glob variables and with mainloop() where i control all sub functions to keep track of the scripts process and not get disturbed by all the small action-functions who doing things. But in subfnct() in another script i can not access to settingA.
Hope anyone can help me use global variables :(
Best Regards
Robert