VB Code:
sc.AddCode "sub main" & vbNewLine & " msgbox ref.a" & vbNewLine & "end sub"
Dim obj(5) As New clstest
Dim counter As Byte
For counter = 0 To 5
obj(counter).a = counter 'makes each element different
Next counter
Dim ref As clstest
Set ref = obj(0)
sc.AddObject "ref", ref 'add the REFERENCE object
sc.Run "main" 'makes a message box with 0
MsgBox ref.a 'displays 0
Set ref = obj(3)
sc.AddObject "ref", ref 'add the REFERENCE object
sc.Run "main" 'should make a messagebox with 3, but makes it with 0
MsgBox ref.a 'displays 3
It added obj(0) to the Engine, but resetting the reference doesn't change the reference in the script engine....