|
|
Line 19: |
Line 19: |
| <syntaxhighlight lang="nasal"> | | <syntaxhighlight lang="nasal"> |
| io.readfile(file); | | io.readfile(file); |
| </syntaxhighlight>
| |
|
| |
| == Reading Nasal files ==
| |
| === io.include() ===
| |
| Loads and executes a Nasal file in place. The file is searched for in the
| |
| calling script directory and in standard FG directories (in that order).
| |
| Examples:
| |
| <syntaxhighlight lang="nasal">
| |
| io.include("Aircraft/Generic/library.nas");
| |
| io.include("my_other_file.nas");
| |
| </syntaxhighlight>
| |
|
| |
| === io.load_nasal() ===
| |
| Loads Nasal file into namespace and executes it. The namespace
| |
| (module name) is taken from the optional second argument, or
| |
| derived from the Nasal file's name.
| |
| <syntaxhighlight lang="nasal">
| |
| Usage: io.load_nasal(<filename> [, <modulename>]);
| |
| </syntaxhighlight>
| |
| Examples:
| |
| <syntaxhighlight lang="nasal">
| |
| io.load_nasal(getprop("/sim/fg-root") ~ "/Local/test.nas");
| |
| io.load_nasal("/tmp/foo.nas", "test");
| |
| </syntaxhighlight> | | </syntaxhighlight> |
|
| |
|