Forum Discussion
sbkeenan
11 years agoFrequent Contributor
Hi Leon
What scripting language are you using?
In VBScript, for example, you can do this:
----- Unit1 -----
----- Unit2 -----
If you are using a class, say in unit 2, you'll need to write a global function, i.e. outside the class, so that you can create an instance of it, for example:
----- Unit1 -----
----- Unit2 -----
As far as I know, if you're using JScript, you will not need to create the global function outside the class, you will, instead, simply be able to create a new instance in Unit1 by using
Hope this helps.
Regards
Stephen.
What scripting language are you using?
In VBScript, for example, you can do this:
----- Unit1 -----
'USEUNIT Unit2
sub main
dim x, y, z
x = 3
y = 4
z = unit2.mySum(x, y)
log.message("Sum is " & z)
end sub
----- Unit2 -----
function mySum(num1, num2)
mySum = num1 + num2
end function
If you are using a class, say in unit 2, you'll need to write a global function, i.e. outside the class, so that you can create an instance of it, for example:
----- Unit1 -----
'USEUNIT Unit2
dim mc = Unit2.newMyClass()
sub main
dim x, y, z
x = 3
y = 4
z = mc.mySum(x, y)
log.message("Sum is " & z)
end sub
----- Unit2 -----
function newMyClass()
set newMyClass = new myClass
end function
class myClass
function mySum(num1, num2)
mySum = num1 + num2
end function
end class
As far as I know, if you're using JScript, you will not need to create the global function outside the class, you will, instead, simply be able to create a new instance in Unit1 by using
var mc = new Unit2.myClass();
Hope this helps.
Regards
Stephen.
Related Content
Recent Discussions
- 2 days ago
- 2 days ago
- 5 days ago