A script module represents a single TkScript source code file.
Modules can contain
- namespace
- class
- function
- variable
- constant
declarations as well as
- global initialization statements that are run before the main() function is called.
A script project that uses more than one source file
must have a project file that lists all sources, see
Projects and TKX archives
.
Simple example for a project file
myproject.tkp
:
MyClass.tks
MyOtherClass.tks
main.tks
| |
Each module has to be assigned a unique
module name:
// ---- file: myscript.tks
// ---- purpose: just a simple example module
module MMyScript; // <-- assign module name
print "hello, world."; // <-- initialization code, will be run before main() function
Up: |
- TkScript Reference Guide » Modules » Common module include directory
|
Project file entries whose filename starts with
mod:
are searched in the
TKS_MODULE_PATH
.
The included files will be "statically linked" in a packaged
application/x-tkx
or
application/x-tsl
file.
This mechanism was mainly used before the "script library" feature was added to TkScript.
It may still be useful for mini-libraries.