Shop OBEX P1 Docs P2 Docs Learn Events
return value from an object — Parallax Forums

return value from an object

OwenOwen Posts: 100
edited 2007-01-20 17:52 in Propeller 1
Is it possible in spin to get a return value from an object? or does this only work between methods in a single object? i'm trying to return the number of steps a motor takes from one object and use it in the toplevel object but cant seem to get it to work.
thanks,
Owen

Comments

  • Luis DigitalLuis Digital Posts: 371
    edited 2007-01-20 15:11
    Yes that is normal.

    PUB Toplevel
    value := Obj_X

    No toplevel objetc:

    PUB Obj_X : x
    a:= y
    return a

    Or

    x:= a
  • OwenOwen Posts: 100
    edited 2007-01-20 16:23
    Can I still get a value back to the topobject from a method that was started in a new cog in an object outside the top level object. somehow it's not working for me
    Owen
  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-20 16:38
    It should work (and does work for others). You'll have to post the particular program where you have the problem (do it as an attachment) so we can have a look at it. The problem often is not what you might think.
    Mike
Sign In or Register to comment.