Shop OBEX P1 Docs P2 Docs Learn Events
Universal variables on the prop — Parallax Forums

Universal variables on the prop

mosquito56mosquito56 Posts: 387
edited 2009-05-14 18:21 in Propeller 1
·· In the programs scogs, which starts each cog and writes a string "....34567" to indicate that cogs 0..2 are being used and 3..7 are free it fills a string called cstr. When I put a string called the same in my main program and call scogs and print cstr in my main program I get "3....4567" This would indicate that the scogs is communicating with· the variable shared with my main program.
· I am trying to duplicate this effect with another variable. I have
dat
varrrr byte "........",0 in both objects

I use


·· repeat x from 0 to 2
···· varrr.byte[noparse][[/noparse]x]:=x+48
printstr(@varrr)
and it's ok.· It prints 012........ which is what is expected

but in my secondary object
y:=57
varrr.byte[noparse][[/noparse]4]:=·y it doesn't change the val when printed



if 2 objects have the same name in the dat section, shouldn't they be "universal variables" I plan to move this to another cog when I finish.

Thanks.


·

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·······

······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
········

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-05-14 17:42
    If I understand your question correctly, the namespaces for different objects are completely separate. Otherwise, it would be impossible to have an Object Exchange, since you'd have to check every object you use for naming conflicts.

    -Phil
  • mosquito56mosquito56 Posts: 387
    edited 2009-05-14 18:21
    yeah, makes sense thanx



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·······

    ······· "What do you mean, it doesn't have any tubes?"
    ······· "No such thing as a dumb question" unless it's on the internet
    ········
Sign In or Register to comment.