Shop OBEX P1 Docs P2 Docs Learn Events
calling a method from different spin file — Parallax Forums

calling a method from different spin file

bigirvbigirv Posts: 37
edited 2011-12-12 17:00 in Propeller 1
Sorry if this has already been answered but how would I call a method in file1.spin thats in file2.spin. Do I create an object file2 or the method that im wanting to call?

Comments

  • doggiedocdoggiedoc Posts: 2,245
    edited 2011-12-12 16:35
    Hey bigirv! You'll need to declare the file2.spin as an object in the OBJ block of your file1.spin code. Then you can call methods from file2.spin from file1.spin using dot notation.

    I'll get an example or link shortly.

    Paul
  • doggiedocdoggiedoc Posts: 2,245
    edited 2011-12-12 16:47
    From the Propeller Manual: pg141 Explanation of the OBJ (block command)
    For Example: where Start is a PUB method in file2.spin
    OBJ
      myObject : "file2"
    
    PUB myMethod
      myObject.Start
     .... 'remaining code
    
    
  • bigirvbigirv Posts: 37
    edited 2011-12-12 17:00
    thanks figured it would be that easy :P
Sign In or Register to comment.