Passing variable values within the same plugin? is it possible? I'm having problems...

  • Hello,

    I suppose the title is not really clear, but I do not know how to title my problem...

    So here is the thing...


    I have a plugin which contains more than one field:

    Code
    <plugin name="var"
    A="text1"
    B="text2"
    >

    If I do


    Code
    trace(get(plugin[var].A),'   ',get(plugin[var].B));
    set(plugin[var].A,'text3');
    trace(get(plugin[var].A),'   ',get(plugin[var].B));

    then I get an output like

    Code
    text1 text2
    text3 text2

    So, everything is fine!

    Now if I want to get the value of var.A into var.B, then I do

    Code
    trace(get(plugin[var].A),'   ',get(plugin[var].B));
    set(plugin[var].B,get(plugin[var].A));
    trace(get(plugin[var].A),'  ',get(plugin[var].B));

    with the output like

    Code
    text1 text2
    text1   text1

    If I however try to do the following thing

    Code
    trace(get(plugin[var].A),'   ',get(plugin[var].B));
    set(plugin[var].B,get(plugin[var].A));
    set(plugin[var].A,text4);
    trace(get(plugin[var].A),'  ',get(plugin[var].A));

    I get as an output

    Code
    text1 text2
    text4   text4

    when what I would expect is

    Code
    text1 text2
    text4   text1

    So, somehow plugin[var].B ist also affected by the set(plugin[var].A,text4) line due to the comand set(plugin[var].B,get(plugin[var].A)); before, although it is not even 'touching' that variable.

    How can this be?????
    What am I doing wrong??

    Cheers

  • I suppose there's a typo in the last line of your latter example:

    Code
    trace(get(plugin[var].A),'   ',get(plugin[var].B));
    set(plugin[var].B,get(plugin[var].A));
    set(plugin[var].A,text4);
    trace(get(plugin[var].A),'  ',get(plugin[var].A));

    you meant this, I suppose:

    Code
    trace(get(plugin[var].A),'   ',get(plugin[var].B));
    set(plugin[var].B,get(plugin[var].A));
    set(plugin[var].A,text4);
    trace(get(plugin[var].A),'  ',get(plugin[var].B));

    So you were tracing plugin A two times.

    Regards,

    Alexey

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!