Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Importing Modules that are in seperate files?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
poww10s




PostPosted: Fri Apr 04, 2014 11:57 pm   Post subject: Importing Modules that are in seperate files?

What is it you are trying to achieve?
Import a Module that is in a Sub Folder to the main programs directory.


What is the problem you are having?
I have no clue how to do it. The only thing I have thought of was using the Directory stuff.


Describe what you have tried to solve this problem
Messing with the Directory commands.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Just gonna put this:
Turing:


import loadingModule



Please specify what version of Turing you are using
4.1
Sponsor
Sponsor
Sponsor
sponsor
Dreadnought




PostPosted: Sat Apr 05, 2014 9:33 am   Post subject: Re: Importing Modules that are in seperate files?

What you're missing is the "in" keyword.

Turing:
import MyModule in "subdirectory\\MyModule.tu"
Raknarg




PostPosted: Sat Apr 05, 2014 11:26 am   Post subject: RE:Importing Modules that are in seperate files?

Another point: As far as I'm aware, you cannot do anything with the directory before you import. If you want to import anything, import has to be the first line of code.
poww10s




PostPosted: Sat Apr 05, 2014 4:25 pm   Post subject: RE:Importing Modules that are in seperate files?

Oh, this makes sense. thanks a lot!
Clayton




PostPosted: Thu Apr 10, 2014 6:34 am   Post subject: Re: Importing Modules that are in seperate files?

Dreadnought @ Sat Apr 05, 2014 9:33 am wrote:
What you're missing is the "in" keyword.

Turing:
import MyModule in "subdirectory\\MyModule.tu"


This is only true if the unit file isn't placed within the same directory that the main program would compile from at runtime. If they are in the same directory however, telling the compiler where to find the module is not entirely necessary.
Raknarg




PostPosted: Thu Apr 10, 2014 10:03 am   Post subject: RE:Importing Modules that are in seperate files?

If you're going to bother with additional units, it might be better practice to have a directory for them
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: