Hi,
Information about the call stack is not passed across units (JScript doesn't have native support for multiple units).
You can try using the following function to call routines across units and get the caller name:
function callFunction(name)
{
var args = arguments;
var callStr = name + "(";
for(var i = 1; i < args.length; i++)
callStr += ((VarType(args) == varOleStr)?"\"" + args + "\"":args) + ", ";
callStr += "\"" + arguments.callee.caller.toString().match(/function (\w*)/)[1] + "\")";
return eval(callStr);
}
Here's how to use it:
//Unit1
function callFunction(name)
{
//
}
...
var result = callFunction("Unit2.myFunction", "some parameter", "some other parameter");
...
//Unit2
function myFunction(p1, p2)
{
// Obtain the caller name:
var callerName = arguments[arguments.length - 1];
// Some code
return "something";
}
In the code above, the caller name is passed to the target function as an additional parameter (it is passed after 'p1' and 'p2' in the example).