 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Fri Aug 03, 2007 10:10 am
[1.34] Acessing cross module variable based on variable name |
It's confusing buy here's what I want to do.
I have Module1 and Modul2.
In an event in Module1 I want to assign a variable Test in Module2.
Now if I explicitly type
| Code: |
| //Module2/Test = 400 |
However if I want to do it based on a variable (say a parameter passed to the event I can't). Assuming a valid local variable '$name' the following doesn't work because CMUD treats it like a commented line.
| Code: |
//$Name/Test = 400
#VAR //$Name/Test 400 |
So am I missing something or is it a bug? (I'm guessing there's probably another way to do it, but it's late. |
|
_________________ Asati di tempari! |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Aug 03, 2007 10:57 am |
Firstly, provided both modules can see each other and there aren't any other variables called test, you don't need to do it explicitly, even across packages. So don't if you don't have to.
Secondly, it's the implicit concatenation that's buggering it up. This will work:
#var %concat("//",$Name,"/Test") {a new value} |
|
|
|
 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Fri Aug 03, 2007 9:19 pm |
I'll try the #VAR command.
The reason I want to explicitly assign it is that I eventually plan to put these in the package library so I don't want to assume what else may be there. For my local I can control, but in the wild, who knows.
[Edit] That worked. Thanks Fang. I actually was trying that last night, but I guess I was too tired to think it through properly. |
|
_________________ Asati di tempari! |
|
|
 |
|
|
|