Forum Discussion

Pakema's avatar
Pakema
Contributor
16 years ago

Bug with using public variable

I'm using TC 8.0 Ent, VBScript

I have 3 units



Content of Unit1:





'USEUNIT Unit2  


'USEUNIT Unit3







Function f2


Dim a


res = f1(var1)


ShowMessage(var1)


End Function ' f2



Content of Unit2:



 


Function f1(ByRef tVar)



 f1 = True


 tVar = 10


End Function ' f1




Content of Unit3:



Public var1     




In Result when I start execute f2 - var1 = Empty.



Why?



P.S. This example in attach

1 Reply

  • Hi Nikita,


    The reason for this is that multiple units are not supported by the scripting engine natively. Declare var1 as a global variable in Unit1 instead.