shaifali_pandya
12 years agoOccasional Contributor
Global variable
Need help understand why a global array vailable declared in unit1.sj outside of any function is not available in another script file.
Unit1.sj
//USEUNIT ErrorReporter
Unit1.sj
//USEUNIT ErrorReporter
var vectErrMsgs = new Array();
function Trial()
{
if (!ErrorReporter.ReportError("Unable to understand", "Global array not populated as expected.", "this.function", false))
Log.Error("Problem");
}
ErrorReporter.sj
function ReportError(strErrCategory, strErrText, strErrOrigin, bCapDesktop)
{
var myDesktopPic = null;
if ((bCapDesktop ==null) || (bCapDesktop!= false))
myDesktopPic = Sys.Desktop.Picture(); //Take picture of the desktop
var strMessageText = strErrCategory + " - " + strErrText + "\n\n" + strErrOrigin;
vectErrMsgs.push([myDesktopPic, strMessageText]); //push err message text into an array.
return true;
}