Shop OBEX P1 Docs P2 Docs Learn Events
Help finding something in manual. — Parallax Forums

Help finding something in manual.

TCTC Posts: 1,019
edited 2007-08-23 03:30 in Propeller 1
Hello all, I can not seem to find in the prop·manual (v1.0) any info how a RESULT varable can·go from one object to another.

Thanks
TC

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
We all make mistakes when we are young………That’s why paste is edible!

Comments

  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-08-22 23:40
    open the manual again, use search (the binoculars), enter the phrase "return value", bone up.
  • TCTC Posts: 1,019
    edited 2007-08-23 00:13
    OK, I tryed Adobe search, I recived 41 instances of " Return value ". none of them talk about how I can take a result from a public method in object "A" and put it into a varable in the top method. I could be looking for the wrong thing, or I could not be understanding what the manual is saying.

    PS. I payed for the printed manual. I had to download the manual just to use search.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    We all make mistakes when we are young………That’s why paste is edible!
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-08-23 00:20
    value := math.sum(2,3)



    ' example routine in math object
    Pub Sum(x,y) | z
    z := x + y
    return z

    OR
    Pub Sum(x,y) : z
    z := x + y
    ' z is automatically returned when defined as it is

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters- Close out on Adapters!
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-23 00:21
    I don't understand what you mean by "public method" or "top method"...

    Normaly you write
    x:= routine(0)
    
    ...
    pub routine(z)
      return 4711
    
    


    Has nothing to do with objects...
  • TCTC Posts: 1,019
    edited 2007-08-23 01:03
    OK, lets say you have two Object files.

    __________________________________________

    { Main.spin }

    OBJ
    · VALUE:"other"

    PUB DO_SOMETHING
    · TEMP := < WHATEVER from Other.spin >

    ___________________________________________

    { Other.spin }

    PUB GET_VALUE : Other_value
    · Other_Value := < WHATEVER >



    I hope this explains what I am trying to say there are two files. one called " main.spin ". and another file called " Other.spin". Other.spin does somthing to get a value(varable). and puts it in to " Temp " in Main.spin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    We all make mistakes when we are young………That’s why paste is edible!
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-23 01:24
    Obviously it is:
    TEMP := VALUE.GET_VALUE
    



    This is very good style, and called "using a GETter"
  • TCTC Posts: 1,019
    edited 2007-08-23 01:39
    Thanks, I will have to see how it works. I wonder why parallax does not talk about it.( maybe thay do, and I dont know were to look)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    We all make mistakes when we are young………That’s why paste is edible!
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-23 01:45
    Most likely it's too obvious!?
  • DufferDuffer Posts: 374
    edited 2007-08-23 01:59
    Try page 288 of the propeller manual under the sub-heading The Return Value. RESULT is discussed within the context of the PUB statement.

    Steve

    Post Edited (Duffer) : 8/23/2007 2:14:12 AM GMT
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-08-23 02:03
    Not helpful, deSilva. No doughnut for you today.

    The manual's examples tend to set up blinking led's that just DO something but seldom, if ever, return any information. You have to read through most of them to catch ANY glimpse of passing information back to their callers especially when you're working the Object examples. I think the only example is a Success bit.

    A good example, ie short and sweet, is the keyboard_demo.spin. In it you can see how easily a keypress is passed back to the topmost and sent just as quickly to the tv output method.

    ps dS:·· "GETter" is not to be found anywhere in the manual either. If you're going to invent jargon, please take the time to determine if your listener is up to speed or give a guiding context.

    Post Edited (Fred Hawkins) : 8/23/2007 2:09:49 AM GMT
  • TCTC Posts: 1,019
    edited 2007-08-23 02:39
    using keyboard_demo.spin, I understand what is going on now. did not think a varable could go from, keyboard.spin, then keyboard_demo.spin. then TV_Terminal. while using only one line (line 33). Thank you Fred

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    We all make mistakes when we are young………That’s why paste is edible!
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-08-23 03:30
    You're welcome. Becoming that terse in one's thinking (and programing) is something to look forward to.
Sign In or Register to comment.