Author Topic: A global variable assigned to just one file?  (Read 1716 times)

Offline Crivens

  • Prof. Inline
  • *****
  • Posts: 913
    • View Profile
Ok so you make your own routines in separate files to plug into any project and by using local variables you can make sure that you don't step on the toes of the main project with the same variable names.

How do you though make a variable that is shared by all functions in a separate file, but not any other files (especially the main file of the project)? So it's essentially a global variable just for the functions in the non-main source file.

My current example is shop code in a separate file so I can plug it into project of mine without concern about shared variable names. The main function takes in setup colours from the main program. However these same colours are required by other functions in the seperate source file. I don't want to use global variables as mentioned above, but then it is a pain to pass these variables between all functions that use them.

Any ideas?

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

Offline Crivens

  • Prof. Inline
  • *****
  • Posts: 913
    • View Profile
A global variable assigned to just one file?
« Reply #1 on: 2012-Feb-04 »
Shame. Would be nice to have global variables per file. Not impossible to code around just a pain.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.