include (once again)

Monkey Forums/Monkey Programming/include (once again)

pantson(Posted 2011) [#1]
Hi
Has an include been included yet in Monkey? (excuse the terrible pun)

I know its classed as very dirty coding, but I have a game engine and a list of consts that control it. I would like to keep these consts in a seperate file so that I can upgrade the engine without affecting versioning on the game (if that makes sense)


ziggy(Posted 2011) [#2]
You can do this with import. No need include for this. Just import the consts in your engine main file and they'll be available in any pogram importing or using your engine.


pantson(Posted 2011) [#3]
really? that easy?
why haven't I tried this before?


ziggy(Posted 2011) [#4]
Imports "spread" if you import a file, you'll be also importing any files imported by that file. the only limitation is that, if an import is inside a "Private" area, the imports of this area are not populated. Otherwise, yes. It's this easy.


pantson(Posted 2011) [#5]
well that was easy!
many thanks