diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml new file mode 100644 index 0000000..0d43bf3 --- /dev/null +++ b/.github/workflows/on-release.yml @@ -0,0 +1,79 @@ +name: On Release + +on: + workflow_dispatch: # allows manual trigger + release: + types: + - released + - prereleased + +jobs: + build-and-deploy: + if: github.event.release.target_commitish == 'main' + runs-on: ubuntu-latest + environment: release + env: + VERSION: ${{ github.event.release.tag_name }} + PACKAGE_NAME: 'nasal_api_docs' + PACKAGE_COMMAND: 'nasal-api-docs -h' + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: '3.13' + + - name: Package wheel + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade wheel build twine + python -m build . + + FILE_WHL="dist/${PACKAGE_NAME}-${VERSION}-py3-none-any.whl" + FILE_TARGZ="dist/${PACKAGE_NAME}-${VERSION}.tar.gz" + + # check files exists (quoted to be safe) + [ -f "$FILE_WHL" ] || { echo "Wheel not found: $FILE_WHL"; exit 1; } + [ -f "$FILE_TARGZ" ] || { echo "Tarball not found: $FILE_TARGZ"; exit 1; } + + echo "FILE_WHL=$FILE_WHL" >> "$GITHUB_ENV" + echo "FILE_TARGZ=$FILE_TARGZ" >> "$GITHUB_ENV" + echo "Packaged app version: $VERSION at $FILE_WHL" + + - name: Test local installation + run: | + python -m pip install --upgrade --force-reinstall "$FILE_WHL" + $PACKAGE_COMMAND + + - name: Publish to TestPyPI + if: github.event.release.prerelease == true + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }} + run: python -m twine upload --verbose --repository-url https://test.pypi.org/legacy/ dist/* + + - name: Test install from TestPyPI + if: github.event.release.prerelease == true + run: | + python -m pip uninstall -y ${PACKAGE_NAME} || true + + for i in {1..5}; do + python -m pip install \ + --index-url https://test.pypi.org/simple/ \ + --extra-index-url https://pypi.org/simple/ \ + "${PACKAGE_NAME}==${VERSION}" && break + + echo "Waiting for package to appear on TestPyPI..." + sleep 5 + done + + $PACKAGE_COMMAND + + - name: Publish to real PyPI + if: github.event.release.prerelease == false + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: python -m twine upload --verbose dist/* diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..9552fd4 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,29 @@ +name: Lint and Test + +on: + pull_request: + push: + branches: [dev] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.13" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install . + pip install flake8 pylint pytest + + - run: flake8 nasal_api_docs --config setup.cfg + - run: pylint --rcfile setup.cfg nasal_api_docs + - run: pytest diff --git a/.gitignore b/.gitignore index 13bd91e..488480f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,366 +1,22 @@ -# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig +# Python +**__pycache__** +**.pytest_cache** +.pypirc -# Created by https://www.gitignore.io/api/visualstudiocode,windows,pycharm,pycharm+all,pycharm+iml,pydev,python,venv -# Edit at https://www.gitignore.io/?templates=visualstudiocode,windows,pycharm,pycharm+all,pycharm+iml,pydev,python,venv - -### PyCharm ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr - -# CMake -cmake-build-*/ - -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - -# File-based project format -*.iws - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -# Editor-based Rest Client -.idea/httpRequests - -# Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser - -### PyCharm Patch ### -# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 - -# *.iml -# modules.xml -# .idea/misc.xml -# *.ipr - -# Sonarlint plugin -.idea/**/sonarlint/ - -# SonarQube Plugin -.idea/**/sonarIssues.xml - -# Markdown Navigator plugin -.idea/**/markdown-navigator.xml -.idea/**/markdown-navigator/ - -### PyCharm+all ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff - -# Generated files - -# Sensitive or high-churn files - -# Gradle - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr - -# CMake - -# Mongo Explorer plugin - -# File-based project format - -# IntelliJ - -# mpeltonen/sbt-idea plugin - -# JIRA plugin - -# Cursive Clojure plugin - -# Crashlytics plugin (for Android Studio and IntelliJ) - -# Editor-based Rest Client - -# Android studio 3.1+ serialized cache file - -### PyCharm+all Patch ### -# Ignores the whole .idea folder and all .iml files -# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 - -.idea/ - -# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 - -*.iml -modules.xml -.idea/misc.xml -*.ipr - -# Sonarlint plugin -.idea/sonarlint - -### PyCharm+iml ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff - -# Generated files - -# Sensitive or high-churn files - -# Gradle - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr - -# CMake - -# Mongo Explorer plugin - -# File-based project format - -# IntelliJ - -# mpeltonen/sbt-idea plugin - -# JIRA plugin - -# Cursive Clojure plugin - -# Crashlytics plugin (for Android Studio and IntelliJ) - -# Editor-based Rest Client - -# Android studio 3.1+ serialized cache file - -### PyCharm+iml Patch ### -# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 - - -### pydev ### -.pydevproject - -### Python ### -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# pyenv -.python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# celery beat schedule file -celerybeat-schedule - -# SageMath parsed files -*.sage.py - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# Mr Developer -.mr.developer.cfg -.project - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -### venv ### -# Virtualenv -# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ -[Bb]in -[Ii]nclude -[Ll]ib -[Ll]ib64 -[Ll]ocal -[Ss]cripts -pyvenv.cfg -.env +# Vev .venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ -pip-selfcheck.json - -### VisualStudioCode ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json - -### VisualStudioCode Patch ### -# Ignore all local history of files -.history - -### Windows ### -# Windows thumbnail cache files -Thumbs.db -Thumbs.db:encryptable -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk +venv -# End of https://www.gitignore.io/api/visualstudiocode,windows,pycharm,pycharm+all,pycharm+iml,pydev,python,venv +# Pip +*.egg-info -# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option) +# VSCode +.vscode/settings.json -nasal_api_doc.html -.vscode \ No newline at end of file +# Project +out +backups +FGROOT +tmp +build +dist diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5b989e4 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python Debugger: Module", + "type": "debugpy", + "request": "launch", + "module": "nasal_api_docs", + "args": [ + "-f", + "FGROOT/FGDATA" + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..c761988 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,37 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "View output in a local http server", + "type": "shell", + "problemMatcher": [], + "command": "${command:python.interpreterPath}", + "args": [ + "-m", + "http.server", + "8000", + "-d", + "out", + "-b", + "127.0.0.1" + ] + }, + { + "label": "Test package", + "type": "shell", + "problemMatcher": [], + "command": "${command:python.interpreterPath}", + "args": [ + "-m", + "pytest", + "--basetemp=tmp" + ], + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e04c264 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,68 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [0.2.0] - 2026-04-27 + +### Added + +- Latest generated docs is now deployed to [nasal-api-docs/latest](https://renanmsv.github.io/nasal-api-docs/latest). +- Made this project into a package. +- Added [Changelog](CHANGELOG.md). +- Better logging. + +### Changed + +- New `dev` branch contains all unreleased changes. Now the main branch only gets updated when releases happen. +- Reworked structure and layout (html, css). +- Tweaking the parser. +- Now it outputs a json file together with the HTML file. + +### Removed + +- Archives folder deleted. They have been moved to the [deployment branch](https://github.com/RenanMsV/nasal-api-docs/tree/docs). + +## [0.1.2] - 2025-10-15 + +### Added + +- Add output path argument. + +### Changed + +- Archiving 2019.1.1 docs. +- Update readme with instructions. +- Use argparse to manage arguments. +- Outputs fg version and datetime in the HTML. + +### Removed + +- Drop support for Python 2 script. + +## [0.1.1] - 2019-10-2 + +### Changed + +- Renamed `./python/*` -> `./*`. + +## [0.1.0] - 2019-08-10 + +### Added + +- Initial commit. +- Added LICENSE and README. + +### Changed + +- Converted from Python 2.7 to 3.6; -Output size is bigger. + +[unreleased]: https://github.com/RenanMsV/nasal-api-docs/compare/master...dev +[0.2.0]: https://github.com/RenanMsV/nasal-api-docs/releases/tag/0.2.0 +[0.1.2]: https://github.com/RenanMsV/nasal-api-docs/releases/tag/0.1.2 +[0.1.1]: https://github.com/RenanMsV/nasal-api-docs/releases/tag/0.1.1 +[0.1.0]: https://github.com/RenanMsV/nasal-api-docs/releases/tag/0.1.0 \ No newline at end of file diff --git a/README.md b/README.md index 01400d5..1a4a811 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,38 @@ -# Nasal API Docs Generator +# Nasal API Docs Auto generates Nasal API documentation from FlightGear's nasal scripts. -Original python2 script by @2012 Adrian Musceac +* Original python2 script by Adrian Musceac @2012. +* Refactored into a package by RenanMsV @2019-2026. -## How to execute: +--- -Run the **Python 3** console command below: +### Latest generated docs + +πŸ“ƒ View the latest docs here: [nasal-api-docs/latest](https://renanmsv.github.io/nasal-api-docs/latest). + +--- + +### Requirements + +- Requires **Python 3.7** or newer. + +- Uses [Jinja2](https://pypi.org/project/Jinja2/) module to generate the HTML. +To install Jinja2 run the console command below: + ```bash + pip install jinja2 + ``` + +--- + +### How to install and run: + +Install with: ```bash -python3 nasal_api_doc.py -f /path/to/FlightGear/data +pip install . ``` -For more info about the commands: +Run the command: ```bash -python3 nasal_api_doc.py --help -``` \ No newline at end of file +nasal-api-docs -f /path/to/FlightGear/data -o /path/to/output/ +``` diff --git a/archives/nasal_api_doc-2019.1.1.html b/archives/nasal_api_doc-2019.1.1.html deleted file mode 100644 index 4d6513f..0000000 --- a/archives/nasal_api_doc-2019.1.1.html +++ /dev/null @@ -1,6077 +0,0 @@ - Nasal API -

Nasal $FGROOT Library
Flightgear version: 2019.1.1
This file is generated automatically by scripts/python/nasal_api_doc.py


Nasal documentation   Flightgear Nasal documentation -
 

-addons 
-aircraft 
-aurora 
-bits 
-checklist 
-contrail 
-controls 
-debug 
-dynamic_view 
-earthview 
-emesary 
-emesary_mp_bridge 
-environment 
-events 
-fuel 
-geo 
-glide_slope_tunnel 
-globals 
-gui 
-io 
-joystick 
-lag_adjust 
-local_weather_auto_init 
-material 
-math 
-mp_broadcast 
-multikey 
-multiplayer 
-notifications 
-orbital_target 
-prop_key_handler 
-props 
-redout 
-route_manager 
-scenery 
-screen 
-seaport 
-string 
-tanker 
-track_target 
-video 
-view 
-volcano 
-weather_scenario 
-wildfire 
-windsock 
-FailureMgr 
-canvas 
-console 
-input_helpers 
-jetways 
-jetways_edit 
-local_weather 
-performance_monitor 
-std 
-towing 
-tutorial 
-

-
-

addons

-

addons._listeners

-
Initialize addons configured with --addon=foobar command line switch:

-
- get the list of registered add-ons

-
- load the addon-main.nas file of each add-on into namespace

-
__addon[ADDON_ID]__

-
- call function main() from every such addon-main.nas with the add-on ghost

-
as argument (an addons.Addon instance).

-
Example:

-
fgfs --addon=/foo/bar/baz

-
- AddonManager.cxx parses /foo/bar/baz/addon-metadata.xml

-
- AddonManager.cxx creates prop nodes under /addons containing add-on metadata

-
- AddonManager.cxx loads /foo/bar/baz/addon-config.xml into the Property Tree

-
- AddonManager.cxx adds /foo/bar/baz to the list of aircraft paths (to get

-
permissions to read files from there)

-
- this script loads /foo/bar/baz/addon-main.nas into namespace

-
__addon[ADDON_ID]__

-
- this script calls main(addonGhost) from /foo/bar/baz/addon-main.nas.

-
- the add-on ghost can be used to retrieve most of the add-on metadata, for

-
instance:

-
addonGhost.id the add-on identifier

-
addonGhost.name the add-on name

-
addonGhost.version.str() the add-on version as a string

-
addonGhost.basePath the add-on base path (realpath() of

-
"/foo/bar/baz" here)

-
etc.

-
For more details, see $FG_ROOT/Docs/README.add-ons.

-
hashes to store listeners and timers per addon ID

-
-

addons._timers

-
-

addons.getNamespaceName ( a )

-
-

addons.load ( a )

-
-

addons.remove ( a )

-
-

addons._reloadFlags

-
-

addons.reload ( a )

-
-

addons.init ( )

-
-
-

aircraft

-

aircraft.makeNode ( n )

-
helper functions

-
creates (if necessary) and returns a property node from arg[0],

-
which can be a property node already, or a property path

-
-

aircraft.optarg ( args, index, default )

-
returns args[index] if available and non-nil, or default otherwise

-
-

aircraft.door

-
door

-
class for objects moving at constant speed, with the ability to

-
reverse moving direction at any point. Appropriate for doors, canopies, etc.

-
SYNOPSIS:

-
door.new(<property>, <swingtime> [, <startpos>]);

-
property ... door node: property path or node

-
swingtime ... time in seconds for full movement (0 -> 1)

-
startpos ... initial position (default: 0)

-
PROPERTIES:

-
./position-norm (double) (default: <startpos>)

-
./enabled (bool) (default: 1)

-
EXAMPLE:

-
var canopy = aircraft.door.new("sim/model/foo/canopy", 5);

-
canopy.open();

-
-

aircraft.door.new ( node, swingtime, pos = 0 )

-
-

aircraft.door.enable ( v )

-
door.enable(bool) -> set ./enabled

-
-

aircraft.door.setpos ( pos )

-
door.setpos(double) -> set ./position-norm without movement

-
-

aircraft.door.getpos ( )

-
double door.getpos() -> return current position as double

-
-

aircraft.door.close ( )

-
door.close() -> move to closed state

-
-

aircraft.door.open ( )

-
door.open() -> move to open state

-
-

aircraft.door.toggle ( )

-
door.toggle() -> move to opposite end position

-
-

aircraft.door.stop ( )

-
door.stop() -> stop movement

-
-

aircraft.door.move ( target )

-
door.move(double) -> move to arbitrary position

-
-

aircraft.light

-
light

-
class for generation of pulsing values. Appropriate for controlling

-
beacons, strobes, etc.

-
SYNOPSIS:

-
light.new(<property>, <pattern> [, <switch>]);

-
light.new(<property>, <stretch>, <pattern> [, <switch>]);

-
property ... light node: property path or node

-
stretch ... multiplicator for all pattern values

-
pattern ... array of on/off time intervals (in seconds)

-
switch ... property path or node to use as switch (default: ./enabled)

-
instead of ./enabled

-
PROPERTIES:

-
./state (bool) (default: 0)

-
./enabled (bool) (default: 0) except if <switch> given)

-
EXAMPLES:

-
aircraft.light.new("sim/model/foo/beacon", [0.4, 0.4]); anonymous light

-
-------

-
var strobe = aircraft.light.new("sim/model/foo/strobe", [0.05, 0.05, 0.05, 1],

-
"controls/lighting/strobe");

-
strobe.switch(1);

-
-------

-
var switch = props.globals.getNode("controls/lighting/strobe", 1);

-
var pattern = [0.02, 0.03, 0.02, 1];

-
aircraft.light.new("sim/model/foo/strobe-top", 1.001, pattern, switch);

-
aircraft.light.new("sim/model/foo/strobe-bot", 1.005, pattern, switch);

-
-

aircraft.light.new ( )

-
-

aircraft.light.del ( )

-
class destructor

-
-

aircraft.light.switch ( v )

-
light.switch(bool) -> set light switch (also affects other lights

-
that use the same switch)

-
-

aircraft.light.toggle ( )

-
light.toggle() -> toggle light switch

-
-

aircraft.light.cont ( )

-
light.cont() -> continuous light

-
-

aircraft.light.blink ( count = -1, endstate = 0 )

-
light.blink() -> blinking light (default)

-
light.blink(3) -> when switched on, only run three blink sequences;

-
second optional arg defines state after the sequences

-
-

aircraft.light._switch_ ( )

-
-

aircraft.light._loop_ ( id )

-
-

aircraft.lowpass

-
lowpass

-
class that implements a variable-interval EWMA (Exponentially Weighted

-
Moving Average) lowpass filter with characteristics independent of the

-
frame rate.

-
SYNOPSIS:

-
lowpass.new(<coefficient>);

-
EXAMPLE:

-
var lp = aircraft.lowpass.new(1.5);

-
print(lp.filter(10)); prints 10

-
print(lp.filter(0));

-
-

aircraft.lowpass.new ( coeff )

-
-

aircraft.lowpass.filter ( v )

-
filter(raw_value) -> push new value, returns filtered value

-
-

aircraft.lowpass.get ( )

-
get() -> returns filtered value

-
-

aircraft.lowpass.set ( v )

-
set() -> sets new average and returns it

-
-

aircraft.lowpass._filter_ ( v )

-
-

aircraft.angular_lowpass

-
angular lowpass

-
same as above, but for angles. Filters sin/cos separately and calculates the

-
angle again from them. This avoids unexpected jumps from 179.99 to -180 degree.

-
-

aircraft.angular_lowpass.new ( coeff )

-
-

aircraft.angular_lowpass.filter ( v )

-
-

aircraft.angular_lowpass.set ( v )

-
-

aircraft.angular_lowpass.get ( )

-
-

aircraft.data

-
class that loads and saves properties to aircraft-specific data files in

-
~/.fgfs/aircraft-data/ (Unix) or %APPDATA%\flightgear.org\aircraft-data\.

-
There's no public constructor, as the only needed instance gets created

-
by the system.

-
SYNOPSIS:

-
data.add(<properties>);

-
data.save([<interval>])

-
properties ... about any combination of property nodes (props.Node)

-
or path name strings, or lists or hashes of them,

-
lists of lists of them, etc.

-
interval ... save in <interval> minutes intervals, or only once

-
if 'nil' or empty (and again at reinit/exit)

-
SIGNALS:

-
/sim/signals/save ... set to 'true' right before saving. Can be used

-
to update values that are to be saved

-
EXAMPLE:

-
var p = props.globals.getNode("/sim/model", 1);

-
var vec = [p, p];

-
var hash = {"foo": p, "bar": p};

-
add properties

-
aircraft.data.add("/sim/fg-root", p, "/sim/fg-home");

-
aircraft.data.add(p, vec, hash, "/sim/fg-root");

-
now save only once (and at exit/reinit, which is automatically done)

-
aircraft.data.save();

-
or save now and every 30 sec (and at exit/reinit)

-
aircraft.data.save(0.5);

-
-

aircraft.data.init ( )

-
-

aircraft.data.load ( )

-
-

aircraft.data.save ( v = nil )

-
-

aircraft.data._loop_ ( id )

-
-

aircraft.data._save_ ( )

-
-

aircraft.data.add ( p... )

-
-

aircraft.timer

-
timer

-
class that implements timer that can be started, stopped, reset, and can

-
have its value saved to the aircraft specific data file. Saving the value

-
is done automatically by the aircraft.Data class.

-
SYNOPSIS:

-
timer.new(<property> [, <resolution:double> [, <save:bool>]])

-
<property> ... property path or props.Node hash that holds the timer value

-
<resolution> ... timer update resolution -- interval in seconds in which the

-
timer property is updated while running (default: 1 s)

-
<save> ... bool that defines whether the timer value should be saved

-
and restored next time, as needed for Hobbs meters

-
(default: 1)

-
EXAMPLES:

-
var hobbs_turbine = aircraft.timer.new("/sim/time/hobbs/turbine[0]", 60);

-
hobbs_turbine.start();

-
aircraft.timer.new("/sim/time/hobbs/battery", 60).start(); anonymous timer

-
-

aircraft.timer.new ( prop, res = 1, save = 1 )

-
-

aircraft.timer.del ( )

-
-

aircraft.timer.start ( )

-
-

aircraft.timer.stop ( )

-
-

aircraft.timer.reset ( )

-
-

aircraft.timer._apply_ ( )

-
-

aircraft.timer._save_ ( )

-
-

aircraft.timer._loop_ ( id )

-
-

aircraft.livery

-
livery

-
Class that maintains livery XML files (see English Electric Lightning for an

-
example). The last used livery is saved on exit and restored next time. Livery

-
files are regular PropertyList XML files whose properties are copied to the

-
main tree.

-
SYNOPSIS:

-
livery.init(<livery-dir> [, <name-path> [, <sort-path>]]);

-
<livery-dir> ... directory with livery XML files, relative to $FG_ROOT

-
<name-path> ... property path to the livery name in the livery files

-
and the property tree (default: sim/model/livery/name)

-
<sort-path> ... property path to the sort criterion (default: same as

-
<name-path> -- that is: alphabetic sorting)

-
EXAMPLE:

-
aircraft.livery.init("Aircraft/Lightning/Models/Liveries",

-
"sim/model/livery/variant",

-
"sim/model/livery/index"); optional

-
aircraft.livery.dialog.toggle();

-
aircraft.livery.select("OEBH");

-
aircraft.livery.next();

-
-

aircraft.livery.init ( dir, nameprop = )

-
-

aircraft.livery_update

-
livery_update

-
Class for maintaining liveries in MP aircraft. It is used in Nasal code that's

-
embedded in aircraft animation XML files, and checks in intervals whether the

-
parent aircraft has changed livery, in which case it changes the livery

-
in the remote aircraft accordingly. This class is a wrapper for overlay_update.

-
SYNOPSIS:

-
livery_update.new(<livery-dir> [, <interval:10> [, <func>]]);

-
<livery-dir> ... directory with livery files, relative to $FG_ROOT

-
<interval> ... checking interval in seconds (default: 10)

-
<func> ... callback function that's called with the ./sim/model/livery/file

-
contents as argument whenever the livery has changed. This can

-
be used for post-processing.

-
EXAMPLE:

-
<nasal>

-
<load>

-
var livery_update = aircraft.livery_update.new(

-
"Aircraft/R22/Models/Liveries", 30,

-
func print("R22 livery update"));

-
</load>

-
<unload>

-
livery_update.stop();

-
</unload>

-
</nasal>

-
-

aircraft.livery_update.new ( liveriesdir, interval = 10.01, callback = nil )

-
-

aircraft.livery_update.stop ( )

-
-

aircraft.overlay_update

-
overlay_update

-
Class for maintaining overlays in MP aircraft. It is used in Nasal code that's

-
embedded in aircraft animation XML files, and checks in intervals whether the

-
parent aircraft has changed an overlay, in which case it copies the respective

-
overlay to the aircraft's root directory.

-
SYNOPSIS:

-
livery_update.new();

-
livery_update.add(<overlay-dir>, <property> [, <callback>]);

-
<overlay-dir> ... directory with overlay files, relative to $FG_ROOT

-
<property> ... MP property where the overlay file name can be found

-
(usually one of the sim/multiplay/generic/string properties)

-
<callback> ... callback function that's called with two arguments:

-
the file name (without extension) and the overlay directory

-
EXAMPLE:

-
<nasal>

-
<load>

-
var update = aircraft.overlay_update.new();

-
update.add("Aircraft/F4U/Models/Logos", "sim/multiplay/generic/string");

-
</load>

-
<unload>

-
update.stop();

-
</unload>

-
</nasal>

-
-

aircraft.overlay_update.new ( )

-
-

aircraft.overlay_update.add ( path, prop, callback = nil )

-
-

aircraft.overlay_update.stop ( )

-
-

aircraft.overlay_update._loop_ ( )

-
-

aircraft.steering

-
steering

-
Class that implements differential braking depending on rudder position.

-
Note that this overrides the controls.applyBrakes() wrapper. If you need

-
your own version, then override it again after the steering.init() call.

-
SYNOPSIS:

-
steering.init([<property> [, <threshold>]]);

-
<property> ... property path or props.Node hash that enables/disables

-
brake steering (usually bound to the js trigger button)

-
<threshold> ... defines range (+- threshold) around neutral rudder

-
position in which both brakes are applied

-
EXAMPLES:

-
aircraft.steering.init("/controls/gear/steering", 0.2);

-
aircraft.steering.init();

-
-

aircraft.steering.init ( switch = )

-
-

aircraft.steering._loop_ ( id )

-
-

aircraft.steering.setbrakes ( left, right )

-
-

aircraft.autotrim

-
autotrim

-
Singleton class that supports quick trimming and compensates for the lack

-
of resistance/force feedback in most joysticks. Normally the pilot trims such

-
that no real or artificially generated (by means of servo motors and spring

-
preloading) forces act on the stick/yoke and it is in a comfortable position.

-
This doesn't work well on computer joysticks.

-
SYNOPSIS:

-
autotrim.start(); on key/button press

-
autotrim.stop(); on key/button release (mod-up)

-
USAGE:

-
(1) move the stick such that the aircraft is in an orientation that

-
you want to trim for (forward flight, hover, ...)

-
(2) press autotrim button and keep it pressed

-
(3) move stick/yoke to neutral position (center)

-
(4) release autotrim button

-
-

aircraft.autotrim.init ( )

-
-

aircraft.autotrim.start ( )

-
-

aircraft.autotrim.stop ( )

-
-

aircraft.autotrim._loop_ ( id )

-
-

aircraft.autotrim.update ( )

-
-

aircraft.autotrim.new ( name )

-
-

aircraft.autotrim.start ( )

-
-

aircraft.autotrim.update ( )

-
-

aircraft.tyresmoke

-
Generic XML particle files are available, but are not mandatory

-
(see Hawker Seahawk for an example).

-
SYNOPSIS:

-
aircraft.tyresmoke.new(gear index [, auto = 0])

-
gear index - the index of the gear to which the tyre smoke is attached

-
auto - enable automatic update (recommended). defaults to 0 for backward compatibility.

-
aircraft.tyresmoke.del()

-
destructor.

-
aircraft.tyresmoke.update()

-
Runs the update. Not required if automatic updates are enabled.

-
EXAMPLE:

-
var tyresmoke_0 = aircraft.tyresmoke.new(0);

-
tyresmoke_0.update();

-
PARAMETERS:

-
number: index of gear to be animated, i.e. "2" for /gear/gear[2]/...

-
auto: 1 when tyresmoke should start on update loop. 0 when you're going

-
to call the update method from one of your own loops.

-
diff_norm: value adjusting the necessary percental change of roll-speed

-
to trigger tyre smoke. Default value is 0.05. More realistic results can

-
be achieved with significantly higher values (i.e. use 0.8).

-
check_vspeed: 1 when tyre smoke should only be triggered when vspeed is negative

-
(usually doesn't work for all gear, since vspeed=0.0 after the first gear touches

-
ground). Use 0 to make tyre smoke independent of vspeed.

-
Note: in reality, tyre smoke doesn't depend on vspeed, but only on acceleration

-
and friction.

-
-

aircraft.tyresmoke.new ( number, auto = 0, diff_norm = 0.05, check_vspeed=1 )

-
-

aircraft.tyresmoke.del ( )

-
-

aircraft.tyresmoke.update ( )

-
-

aircraft.tyresmoke._wowchanged_ ( )

-
-

aircraft.tyresmoke_system

-
tyresmoke_system

-
Helper class to contain the tyresmoke objects for all the gears.

-
Will update automatically, nothing else needs to be done by the caller.

-
SYNOPSIS:

-
aircraft.tyresmoke_system.new(<gear index 1>, <gear index 2>, ...)

-
<gear index> - the index of the gear to which the tyre smoke is attached

-
aircraft.tyresmoke_system.del()

-
destructor

-
EXAMPLE:

-
var tyresmoke_system = aircraft.tyresmoke_system.new(0, 1, 2, 3, 4);

-
-

aircraft.tyresmoke_system.new ( )

-
-

aircraft.tyresmoke_system.del ( )

-
-

aircraft.rain

-
rain

-
Provides a property which can be used to control rain. Can be used to turn

-
off rain in internal views, and or used with a texture on canopies etc.

-
The output is co-ordinated with system precipitation:

-
/sim/model/rain/raining-norm rain intensity

-
/sim/model/rain/flow-mps drop flow speed [m/s]

-
See Hawker Seahawk for an example.

-
SYNOPSIS:

-
aircraft.rain.init();

-
aircraft.rain.update();

-
-

aircraft.rain.init ( )

-
-

aircraft.rain.update ( )

-
-

aircraft.teleport ( airport = speed = 0, distance = 0, azimuth = 0, glideslope = 0, heading = 9999 )

-
teleport

-
Usage: aircraft.teleport(lat:48.3, lon:32.4, alt:5000);

-
-

aircraft.wind_speed_from ( azimuth )

-
returns wind speed [kt] from given direction [deg]; useful for head-wind

-
-

aircraft.kias_to_ktas ( kias, altitude )

-
returns true airspeed for given indicated airspeed [kt] and altitude [m]

-
-

aircraft.HUD

-
HUD control class to handle both HUD implementations

-
-

aircraft.HUD.init ( )

-
-

aircraft.HUD.cycle_color ( )

-
-

aircraft.HUD.cycle_brightness ( )

-
-

aircraft.HUD.normal_type ( )

-
-

aircraft.HUD.cycle_type ( )

-
-

aircraft.HUD.is_active ( )

-
-

aircraft.crossfeed_valve

-
crossfeed_valve

-
class that creates a fuel tank cross-feed valve. Designed for YASim aircraft;

-
JSBSim aircraft can simply use systems code within the FDM (see 747-400 for

-
an example).

-
WARNING: this class requires the tank properties to be ready, so call new()

-
after the FDM is initialized.

-
SYNOPSIS:

-
crossfeed_valve.new(<max_flow_rate>, <property>, <tank>, <tank>, ... );

-
crossfeed_valve.open(<update>);

-
crossfeed_valve.close(<update>);

-
<max_flow_rate> ... maximum transfer rate between the tanks in lbs/sec

-
<property> ... property path to use as switch - pass nil to use no such switch

-
<tank> ... number of a tank to connect - can have unlimited number of tanks connected

-
<update> ... update switch property when opening/closing valve via Nasal - 0 or 1; by default, 1

-
EXAMPLES:

-
aircraft.crossfeed_valve.new(0.5, "/controls/fuel/x-feed", 0, 1, 2);

-
-------

-
var xfeed = aircraft.crossfeed_valve.new(1, nil, 0, 1);

-
xfeed.open();

-
-

aircraft.crossfeed_valve.new ( flow_rate, path )

-
-

aircraft.crossfeed_valve.open ( update_prop = 1 )

-
-

aircraft.crossfeed_valve.close ( update_prop = 1 )

-
-

aircraft.crossfeed_valve._loop_ ( id )

-
-
-

aurora

-

aurora.aurora_manager

-
Aurora Borealis manager

-
this runs once at startup to randomize Aurora appearance

-
a little and otherwise simulates detailed Aurora evolution

-
only when requested by the user

-
-

aurora.aurora_manager.init ( )

-
-

aurora.aurora_manager.state ( )

-
-

aurora.aurora_manager.start ( )

-
-

aurora.aurora_manager.stop ( )

-
-

aurora.aurora_manager.update ( )

-
-

aurora.aurora_manager.evolve ( )

-
-
-

bits

-

bits.test ( n, b )

-
checks whether bit <b> is set in number <n>

-
-

bits.set ( n, b )

-
returns number <n> with bit <b> set

-
-

bits.clear ( n, b )

-
returns number <n> with bit <b> cleared

-
-

bits.toggle ( n, b )

-
returns number <n> with bit <b> toggled

-
-

bits.switch ( n, b, v )

-
returns number <n> with bit <b> set to value <v>

-
-

bits.string ( n, len = 1 )

-
returns number <n> as bit string, zero-padded to <len> digits:

-
bits.string(6) -> "110"

-
bits.string(6, 8) -> "00000110"

-
-

bits.value ( s )

-
returns bit string <s> as number: bits.value("110") -> 6

-
-
-

checklist

-

checklist.convert_checklists ( )

-
Nasal functions for handling the checklists present under /sim/checklists

-
Convert checklists into full tutorials.

-
-
-

contrail

-
-

controls

-

controls.startEngine ( v = 1, which... )

-
-

controls.selectEngine ( which )

-
-

controls.selectEngines ( state, which... )

-
Selects (state=1) or deselects (state=0) a list of engines, or all

-
engines if no list is specified. Example: selectEngines(1, 1, 3, 5);

-
-

controls.selectAllEngines ( )

-
-

controls.stepMagnetos ( change )

-
-

controls.centerFlightControls ( )

-
-

controls.throttleMouse ( )

-
-

controls.axisHandler ( pre, post )

-
Joystick axis handlers (use cmdarg). Shouldn't be called from

-
other contexts. A non-null argument reverses the axis direction.

-
-

controls.perIndexAxisHandler ( pre, post )

-
Joystick axis handler for controlling subsets of similar properties.

-
Shouldn't be called from other contexts.

-
The argument engine can be either an index number or a list of

-
index numbers.

-
Use only when perEngineSelectedAxisHandler() below will not do.

-
-

controls._axisMode

-
Joystick axis handler for controlling a selected axis on specific engines.

-
Shouldn't be called from other contexts.

-
The argument mode can be

-
0 - throttle

-
1 - mixture

-
2 - propeller-pitch

-
The argument engine to the returned function can be either an

-
engine number or a list of engine numbers.

-
Usage example (controlling the mixture of engines 0 and 1):

-
<script>

-
controls.perEngineSelectedAxisHandler(1)([0,1]);

-
</script>

-
-

controls.perEngineSelectedAxisHandler ( mode )

-
-

controls.flapsDown ( step )

-
Wrapper around stepProps() which emulates the "old" flap behavior for

-
configurations that aren't using the new mechanism.

-
-

controls.wingSweep ( step )

-
-

controls.wingsDown ( v )

-
-

controls.stepSpoilers ( step )

-
-

controls.stepSlats ( step )

-
-

controls.stepProps ( dst, array, delta )

-
Steps through an "array" of property settings. The first argument

-
specifies a destination property. The second is a string containing

-
a global property tree. This tree should contain an array of

-
indexed <setting> children. This function will maintain a

-
<current-setting> child, which contains the index of the currently

-
active setting. The third argument specifies an integer delta,

-
indicating how many steps to move through the setting array.

-
Note that because of the magic of the property system, this

-
mechanism works for all scalar property types (bool, int, double,

-
string).

-
TODO: This interface could easily be extended to allow for wrapping,

-
in addition to clamping, allowing a "cycle" of settings to be

-
defined. It could also be hooked up with the interpolate() call,

-
which would allow the removal of the transition-time feature from

-
YASim. Finally, other pre-existing features (the views and engine

-
magnetos, for instance), work similarly but not compatibly, and

-
could be integrated.

-
-

controls.slewProp ( prop, delta )

-
"Slews" a property smoothly, without dependence on the simulator

-
frame rate. The first argument is the property name. The second is

-
a rate, in units per second. NOTE: this modifies the property for

-
the current frame only; it is intended to be called by bindings

-
which repeat each frame. If you want to cause motion over time, see

-
interpolate(). Returns new value.

-
-

controls.elevatorTrim ( speed )

-
Handlers. These are suitable for binding to repeatable button press

-
events. They are *not* good for binding to the keyboard, since (at

-
least) X11 synthesizes its own key repeats.

-
-

controls.aileronTrim ( speed )

-
-

controls.rudderTrim ( speed )

-
-

controls.adjThrottle ( speed )

-
-

controls.adjMixture ( speed )

-
-

controls.adjCondition ( speed )

-
-

controls.adjPropeller ( speed )

-
-

controls.adjEngControl ( prop, speed )

-
-

controls.incThrottle ( )

-
arg[0] is the throttle increment

-
arg[1] is the auto-throttle target speed increment

-
-

controls.incAileron ( )

-
arg[0] is the aileron increment

-
arg[1] is the autopilot target heading increment

-
-

controls.incElevator ( )

-
arg[0] is the elevator increment

-
arg[1] is the autopilot target altitude increment

-
-

controls.elevatorTrimAxis ( )

-
Joystick axis handlers. Don't call from other contexts.

-
-

controls.aileronTrimAxis ( )

-
-

controls.rudderTrimAxis ( )

-
-

controls.gearTogglePosition ( v )

-
to avoid clash with "gearToggle"; this will only toggle when

-
given a parameter of 1; as the controls button binding will pass 0 when the button is pressed and

-
1 when the button is released.

-
-

controls.gearDown ( v )

-
Gear handling.

-
- parameter v is either 1 (down), -1 up (retracted)

-
-

controls.gearToggle ( )

-
-

controls.applyBrakes ( v, which = 0 )

-
-

controls.applyPickle ( v )

-
-

controls.applyParkingBrake ( v )

-
-

controls.parkingBrakeToggle ( v )

-
-

controls.toggleNWS ( v )

-
-

controls.applyApplicableBrakes ( v, which = 0 )

-
allows one binding to do airbrakes and wheel brakes

-
-

controls.deployChute ( v )

-
1: Deploy, -1: Release

-
-

controls.trigger ( b )

-
Weapon handling.

-
-

controls.weaponSelect ( d )

-
-

controls.ptt ( b )

-
Communication.

-
-

controls.toggleLights ( )

-
Lighting.

-
-

controls.replaySkip ( skip_time )

-
-

controls.speedup ( speed_up )

-
-

controls.cycleMouseMode ( node )

-
mouse-mode handling

-
-
-

debug

-

debug._title ( s, color=nil )

-
to <output>, or returning the only result

-
if <repeat> is nil.

-
debug.benchmark_time(<func> [, <repeat:int> [, <output:vector>]])

-
... like debug.benchmark, but returns total

-
execution time and does not print anything.

-
debug.rank(<list:vector> [, <repeat:int>])

-
... sorts the list of functions based on execution

-
time over <repeat> samples (default: 1).

-
debug.print_rank(<result:vector>, <names:int>)

-
... prints the <result> of debug.rank with <names>

-
(which can be a vector of [name, func] or

-
[func, name], or a hash of name:func).

-
debug.printerror(<err-vector>) ... prints error vector as set by call()

-
debug.warn(<message>, <level>) ... generate debug message followed by caller stack trace

-
skipping <level> caller levels (default: 0).

-
debug.propify(<variable>) ... turn about everything into a props.Node

-
debug.Probe class ... base class to collect stats; details below

-
debug.Breakpoint class ... conditional backtrace; details below

-
CAVE: this file makes extensive use of ANSI color codes. These are

-
interpreted by UNIX shells and MS Windows with ANSI.SYS extension

-
installed. If the color codes aren't interpreted correctly, then

-
set property /sim/startup/terminal-ansi-colors=0

-
ANSI color code wrappers (see $ man console_codes)

-
-

debug._section ( s, color=nil )

-
-

debug._error ( s, color=nil )

-
-

debug._bench ( s, color=nil )

-
-

debug._nil ( s, color=nil )

-
-

debug._string ( s, color=nil )

-
-

debug._num ( s, color=nil )

-
-

debug._bracket ( s, color=nil )

-
-

debug._brace ( s, color=nil )

-
-

debug._angle ( s, color=nil )

-
-

debug._vartype ( s, color=nil )

-
-

debug._proptype ( s, color=nil )

-
-

debug._path ( s, color=nil )

-
-

debug._internal ( s, color=nil )

-
-

debug._varname ( s, color=nil )

-
-

debug.propify ( p, create = 0 )

-
Turn p into props.Node (if it isn't yet), or return nil.

-
-

debug.tree ( n = )

-
-

debug._tree ( n, graph = 1, prefix = )

-
-

debug.attributes ( p, verbose = 1, color=nil )

-
-

debug._dump_prop ( p, color=nil )

-
-

debug._dump_var ( v, color=nil )

-
-

debug._dump_string ( str, color=nil )

-
-

debug._dump_key ( s, color=nil )

-
dump hash keys as variables if they are valid variable names, or as string otherwise

-
-

debug.string ( o, color=nil )

-
-

debug.dump ( vars... )

-
-

debug.local ( frame = 0 )

-
-

debug.backtrace ( desc = nil, dump_vars = 1, skip_level = 0 )

-
-

debug.proptrace ( root = )

-
-

debug.benchmark ( label, fn, repeat = nil, output=nil )

-
Executes function fn "repeat" times and prints execution time in seconds. If repeat

-
is an integer and an optional "output" argument is specified, each test's result

-
is appended to that vector, then the vector is returned. If repeat is nil, then

-
the funciton is run once and the result returned. Otherwise, the result is discarded.

-
Examples:

-
var test = func { getprop("/sim/aircraft"); }

-
debug.benchmark("test()/1", test, 1000);

-
debug.benchmark("test()/2", func setprop("/sim/aircraft", ""), 1000);

-
var results = debug.benchmark("test()", test, 1000, []);

-
print(" Results were:");

-
print(" ", debug.string(results));

-
-

debug.benchmark_time ( fn, repeat = 1, output = nil )

-
-

debug.rank ( list, repeat = nil )

-
Executes each function in the list and returns a sorted vector with the fastest

-
on top (i.e. first). Each position in the result is a vector of [func, time].

-
-

debug.print_rank ( label, list, names )

-
-

debug.printerror ( err )

-
print error vector as set by call(). By using call() one can execute

-
code that catches "exceptions" (by a die() call or errors). The Nasal

-
code doesn't abort in this case. Example:

-
var possibly_buggy = func { ... }

-
call(possibly_buggy, nil, var err = []);

-
debug.printerror(err);

-
-

debug.warn ( msg, level = 0 )

-
like die(), but code execution continues. The level argument defines

-
how many caller() levels to omit. One is automatically omitted, as

-
this would only point to debug.warn(), where the event in question

-
didn't happen.

-
-

debug.isnan ( )

-
-

debug.Probe

-
Probe class - collect statistics; controlled via property tree

-
Data can be viewed / modified in the prop tree /_debug/nas/probe-<myLabel>/*

-
./enable bool,

-
./reset bool, reset hit counters to 0 and _start_time to now

-
./hits[i] number of hits, by default i=0 -> hits

-
secondary counters can be added under the same path

-
with addCounter()

-
./time after generateStats() show how long the probe was enabled

-
./hps after generateStats() show avg. hits/second

-
./hitratio after generateStats() if two counters: hits[1]/hits[0]

-
== Example ==

-
var myProbe = debug.Probe.new("myLabel").enable();

-
var cnt2 = myProbe.addCounter(); create a 2nd counter

-
at the place of interest (e.g. in some loop or class method) insert:

-
myProbe.hit(); count how often this place in the code is hit

-
if (condition)

-
myProbe.hit(cnt2); count how often condition is true

-
print(myProbe.getHits());

-
print(myProbe.getHits(cnt2)/myProbe.getHits()); print hit ratio

-
-

debug.Probe.new ( label, class = )

-
label: Used in property path

-
prefix: Optional

-
-

debug.Probe.reset ( )

-
-

debug.Probe.setTimeout ( seconds )

-
set timeout, next hit() after timeout will disable()

-
-

debug.Probe.enable ( )

-
enable counting

-
-

debug.Probe.disable ( )

-
disable counting, write time and hit/s to property tree

-
-

debug.Probe.generateStats ( )

-
-

debug.Probe.getHits ( counter_id = 0 )

-
-

debug.Probe.addCounter ( )

-
add secondary counter(s)

-
returns counter id

-
-

debug.Probe.hit ( counter_id = 0, callback = nil )

-
increase counter (if enabled)

-
use addCounter() before using counter_id > 0

-
-

debug.Breakpoint

-
Breakpoint (BP) - do conditional backtrace (BT) controlled via property tree

-
* count how often the BP was hit

-
* do only a limited number of BT, avoid flooding the log / console

-
Data can be viewed / modified in the prop tree /_debug/nas/bp-<myLabel>/*

-
* tokens: number of backtraces to do; each hit will decrease this by 1

-
* hits: total number of hits

-
== Example ==

-
var myBP = debug.Breakpoint.new("myLabel", 0);

-
myBP.enable(4); allow 4 hits, then be quiet

-
at the place of interest (e.g. in some loop or class method) insert:

-
myBP.hit(); do backtrace here if tokens > 0, reduce tokens by 1

-
myBP.hit(myFunction); same but call myFunction instead of backtrace

-
print(myBP.getHits()); print total number of hits

-
-

debug.Breakpoint.new ( label, dump_locals = 1 )

-
label: Used in property path and as text for backtrace.

-
dump_locals: bool passed to backtrace. Dump variables in BT.

-
-

debug.Breakpoint.enable ( tokens = 1 )

-
enable BP and set hit limit;

-
tokens: int > 0; default: 1 (single shot); 0 allowed (=disable);

-
-

debug.Breakpoint.hit ( callback = nil )

-
hit the breakpoint, e.g. do backtrace if we have tokens available

-
-
-

dynamic_view

-

dynamic_view.sin ( a )

-
-

dynamic_view.cos ( a )

-
-

dynamic_view.sigmoid ( x )

-
-

dynamic_view.nsigmoid ( x )

-
-

dynamic_view.pow ( v, w )

-
-

dynamic_view.npow ( v, w )

-
-

dynamic_view.clamp ( v, min, max )

-
-

dynamic_view.normatan ( x )

-
-

dynamic_view.normdeg ( a )

-
-

dynamic_view.Input

-
Class that reads a property value, applies factor & offset, clamps to min & max,

-
and optionally lowpass filters.

-
-

dynamic_view.Input.new ( prop = )

-
-

dynamic_view.Input.get ( )

-
-

dynamic_view.Input.set ( v )

-
-

dynamic_view.ViewAxis

-
Class that maintains one sim/current-view/goal-*-offset-deg property.

-
-

dynamic_view.ViewAxis.new ( prop )

-
-

dynamic_view.ViewAxis.reset ( )

-
-

dynamic_view.ViewAxis.add_offset ( )

-
-

dynamic_view.ViewAxis.sub_offset ( )

-
-

dynamic_view.ViewAxis.apply ( v )

-
-

dynamic_view.ViewAxis.static ( v )

-
-

dynamic_view.view_manager

-
Singleton class that manages a dynamic cockpit view by manipulating

-
sim/current-view/goal-*-offset-deg properties.

-
-

dynamic_view.view_manager.init ( )

-
-

dynamic_view.view_manager.reset ( )

-
-

dynamic_view.view_manager.add_offset ( )

-
-

dynamic_view.view_manager.apply ( )

-
-

dynamic_view.view_manager.lookat ( heading, pitch, roll, x, y, z, time, fov )

-
-

dynamic_view.view_manager.resume ( )

-
-

dynamic_view.view_manager.freeze ( )

-
-

dynamic_view.view_manager.unfreeze ( )

-
-

dynamic_view.view_manager.default_plane ( )

-
default calculations for a plane

-
-

dynamic_view.view_manager.default_helicopter ( )

-
default calculations for a helicopter

-
-

dynamic_view.main_loop ( id )

-
Update loop for the whole dynamic view manager. It only runs if

-
/sim/current-view/dynamic-view is true.

-
-

dynamic_view.freeze ( )

-
-

dynamic_view.register ( f )

-
-

dynamic_view.reset ( )

-
-

dynamic_view.lookat ( )

-
-

dynamic_view.resume ( )

-
-
-

earthview

-

earthview.check_lightning_table ( lat, lon )

-
-

earthview.start ( )

-
-

earthview.stop ( )

-
-

earthview.place_earth_model ( path, lat, lon, alt, heading, pitch, roll )

-
-

earthview.control_loop ( )

-
-

earthview.slow_loop ( )

-
-

earthview.lightning_strike ( )

-
-

earthview.adjust_cloud_tiles ( )

-
rotate position of cloud tiles

-
-

earthview.clear_cloud_tiles ( )

-
-

earthview.load_sector ( i, n )

-
load of individual tile

-
-

earthview.earth_model

-
-

earthview.cloudsphere_model

-
-

earthview.aurora_model

-
-

earthview.center_N1

-
-

earthview.center_N2

-
-

earthview.center_N3

-
-

earthview.center_N4

-
-

earthview.center_S1

-
-

earthview.center_S2

-
-

earthview.center_S3

-
-

earthview.center_S4

-
-
-

emesary

-
-

emesary_mp_bridge

-
-

environment

-

environment.increaseVisibility ( )

-
environment.nas

-
Nasal code for implementing environment-specific functionality.

-
Handler. Increase visibility by one step

-
-

environment.decreaseVisibility ( )

-
Handler. Decrease visibility by one step

-
-

environment.adjustVisibility ( factor )

-
-

environment.resetVisibility ( )

-
Handler. Reset visibility to default.

-
-
-

events

-

events.LogBuffer

-
-

events.LogBuffer.new ( max_messages = 128, echo = 0 )

-
Stores messages in a circular buffer that then can be retrieved at any point.

-
Messages are time stamped when pushed into the buffer, and the time stamp is

-
-

events.LogBuffer.push ( message )

-
-

events.LogBuffer.clear ( )

-
-

events.LogBuffer.get_buffer ( )

-
-
-

fuel

-

fuel.update ( )

-
-

fuel.loop ( )

-
-
-

geo

-

geo.floor ( v )

-
-

geo.Coord

-
class that maintains one set of geographical coordinates

-
-

geo.Coord.new ( copy = nil )

-
-

geo.Coord._cupdate ( )

-
-

geo.Coord._pupdate ( )

-
-

geo.Coord.x ( )

-
-

geo.Coord.y ( )

-
-

geo.Coord.z ( )

-
-

geo.Coord.xyz ( )

-
-

geo.Coord.lat ( )

-
-

geo.Coord.lon ( )

-
-

geo.Coord.alt ( )

-
-

geo.Coord.latlon ( )

-
-

geo.Coord.set_x ( x )

-
-

geo.Coord.set_y ( y )

-
-

geo.Coord.set_z ( z )

-
-

geo.Coord.set_lat ( lat )

-
-

geo.Coord.set_lon ( lon )

-
-

geo.Coord.set_alt ( alt )

-
-

geo.Coord.set ( c )

-
-

geo.Coord.set_latlon ( lat, lon, alt = 0 )

-
-

geo.Coord.set_xyz ( x, y, z )

-
-

geo.Coord.apply_course_distance ( course, dist )

-
-

geo.Coord.course_to ( dest )

-
-

geo.Coord.distance_to ( dest )

-
arc distance on an earth sphere; doesn't consider altitude

-
-

geo.Coord.direct_distance_to ( dest )

-
-

geo.Coord.is_defined ( )

-
-

geo.Coord.dump ( )

-
-

geo.normdeg ( angle )

-
normalize degree to 0 <= angle < 360

-
-

geo.normdeg180 ( angle )

-
normalize degree to -180 < angle <= 180

-
-

geo.tile_index ( lat, lon )

-
-

geo.format ( lat, lon )

-
-

geo.tile_path ( lat, lon )

-
-

geo.put_model ( path, c, arg... )

-
-

geo._put_model ( path, lat, lon, elev_m = nil, hdg = 0, pitch = 0, roll = 0 )

-
-

geo.elevation ( lat, lon, maxalt = 10000 )

-
-

geo.click_position ( )

-
-

geo.aircraft_position ( )

-
-

geo.viewer_position ( )

-
-

geo.PositionedSearch

-
A object to handle differential positioned searches:

-
searchCmd executes and returns the actual search,

-
onAdded and onRemoved are callbacks,

-
and obj is a "me" reference (defaults to "me" in the

-
caller's namespace). If searchCmd returns nil, nothing

-
happens, i.e. the diff is cancelled.

-
-

geo.PositionedSearch.new ( searchCmd, onAdded, onRemoved, obj=nil )

-
-

geo.PositionedSearch._equals ( a,b )

-
-

geo.PositionedSearch.condense ( vec )

-
-

geo.PositionedSearch.diff ( old, new )

-
-

geo.PositionedSearch.update ( searchCmd=nil )

-
-

geo.PositionedSearch.test ( from=640, to=320 )

-
this is the worst case scenario: switching from 640 to 320 (or vice versa)

-
-
-

glide_slope_tunnel

-

glide_slope_tunnel.normdeg ( a )

-
-

glide_slope_tunnel.best_runway ( apt )

-
Find best runway for current wind direction (or 270), also considering length and width.

-
-

glide_slope_tunnel.draw_tunnel ( rwy )

-
Draw 3 degree glide slope tunnel.

-
-

glide_slope_tunnel.loop ( id )

-
-
-

globals

-

globals.__

-
container for local variables, so as not to clutter the global namespace

-
-

globals.assert ( condition, message=nil )

-
Aborts execution if <condition> evaluates to false.

-
Prints an optional message if present, or just "assertion failed!"

-
-

globals.isa ( obj, class )

-
Returns true if the first object is an instance of the second

-
(class) object. Example: isa(someObject, props.Node)

-
-

globals.fgcommand ( cmd, node=nil )

-
Invokes a FlightGear command specified by the first argument. The

-
second argument specifies the property tree to be passed to the

-
command as its argument. It may be either a props.Node object or a

-
string, in which case it specifies a path in the global property

-
tree.

-
-

globals.cmdarg ( )

-
Returns the SGPropertyNode argument to the currently executing

-
function. Wrapper for the internal _cmdarg function that retrieves

-
the ghost handle to the argument and wraps it in a

-
props.Node object.

-
-

globals.abs ( v )

-
Utility. Does what you think it does.

-
-

globals.interpolate ( node, val... )

-
Convenience wrapper for the _interpolate function. Takes a

-
single string or props.Node object in arg[0] indicating a target

-
property, and a variable-length list of time/value pairs. Example:

-
interpolate("/animations/radar/angle",

-
180, 1, 360, 1, 0, 0,

-
180, 1, 360, 1, 0, 0,

-
180, 1, 360, 1, 0, 0,

-
180, 1, 360, 1, 0, 0,

-
180, 1, 360, 1, 0, 0,

-
180, 1, 360, 1, 0, 0,

-
180, 1, 360, 1, 0, 0,

-
180, 1, 360, 1, 0, 0);

-
This will swing the "radar dish" smoothly through 8 revolutions over

-
16 seconds. Note the use of zero-time interpolation between 360 and

-
0 to wrap the interpolated value properly.

-
-

globals.setlistener ( node, fn, init = 0, runtime = 1 )

-
Wrapper for the _setlistener function. Takes a property path string

-
or props.Node object in arg[0] indicating the listened to property,

-
a function in arg[1], an optional bool in arg[2], which triggers the

-
function initially if true, and an optional integer in arg[3], which

-
sets the listener's runtime behavior to "only trigger on change" (0),

-
"always trigger on write" (1), and "trigger even when children are

-
written to" (2).

-
-

globals.defined ( sym )

-
Returns true if the symbol name is defined in the caller, or the

-
caller's lexical namespace. (i.e. defined("varname") tells you if

-
you can use varname in an expression without a undefined symbol

-
error.

-
-

globals.thisfunc ( caller )

-
Returns reference to calling function. This allows a function to

-
reliably call itself from a closure, rather than the global function

-
with the same name.

-
-

globals.printf ( print )

-
Just what it says it is.

-
-

globals.values ( hash )

-
Returns vector of hash values.

-
-

globals.printlog ( level )

-
-
-

gui

-

gui.popupTip ( label, delay = nil, override = nil, position = nil )

-
Pop up a "tip" dialog for a moment, then remove it. The delay in

-
seconds can be specified as the second argument. The default is 4

-
seconds. The third argument can be a hash with override values.

-
Note that the tip dialog is a shared resource. If someone else

-
comes along and wants to pop a tip up before your delay is finished,

-
you lose. :)

-
-

gui.showDialog ( name )

-
-

gui.menuEnable ( searchname, state )

-
Enable/disable named menu entry

-
-

gui.menuBind ( searchname, command )

-
Set the binding for a menu item to a Nasal script,

-
typically a dialog open() command.

-
-

gui.setCursor ( x = nil, y = nil, cursor = nil )

-
Set mouse cursor coordinates and shape (number or name), and return

-
current shape (number).

-
Example: var cursor = gui.setCursor();

-
gui.setCursor(nil, nil, "wait");

-
-

gui.findElementByName ( dialog,name )

-
Find a GUI element by given name.

-
dialog: dialog root property.

-
name: name of GUI element to be searched.

-
Returns GUI element when found, nil otherwise.

-
-

gui.fpsDisplay ( n )

-
Show/hide the fps display dialog.

-
-

gui.latencyDisplay ( n )

-
-

gui.popdown ( )

-
Pop down the tip dialog, if it is visible.

-
-

gui.Widget

-
Widgets & Layout Management

-
A "widget" class that wraps a property node. It provides useful

-
helper methods that are difficult or tedious with the raw property

-
API. Note especially the slightly tricky addChild() method.

-
-

gui.Widget.set ( name, val )

-
-

gui.Widget.prop ( )

-
-

gui.Widget.new ( )

-
-

gui.Widget.addChild ( type )

-
-

gui.Widget.setColor ( r, g, b, a = 1 )

-
-

gui.Widget.setFont ( n, s = 13, t = 0 )

-
-

gui.Widget.setBinding ( cmd, carg = nil )

-
-

gui.Dialog

-
Dialog class. Maintains one XML dialog.

-
SYNOPSIS:

-
(B) Dialog.new(<dialog-name>); ... use dialog from $FG_ROOT/gui/dialogs/

-
(A) Dialog.new(<prop>, <path> [, <dialog-name>]);

-
... load aircraft specific dialog from

-
<path> under property <prop> and under

-
name <dialog-name>; if no name is given,

-
then it's taken from the XML dialog

-
prop ... target node (name must be "dialog")

-
path ... file path relative to $FG_ROOT

-
dialog-name ... dialog <name> of dialog in $FG_ROOT/gui/dialogs/

-
EXAMPLES:

-
var dlg = gui.Dialog.new("/sim/gui/dialogs/foo-config/dialog",

-
"Aircraft/foo/foo_config.xml");

-
dlg.open();

-
dlg.close();

-
var livery_dialog = gui.Dialog.new("livery-select");

-
livery_dialog.toggle();

-
-

gui.Dialog.new ( prop, path = nil, name = nil )

-
-

gui.Dialog.del ( )

-
-

gui.Dialog.load ( )

-
doesn't need to be called explicitly, but can be used to force a reload

-
-

gui.Dialog.namespace ( )

-
allows access to dialog-embedded Nasal variables/functions

-
-

gui.Dialog.open ( )

-
-

gui.Dialog.close ( )

-
-

gui.Dialog.toggle ( )

-
-

gui.Dialog.is_open ( )

-
-

gui.OverlaySelector

-
Overlay selector. Displays a list of overlay XML files and copies the

-
chosen one to the property tree. The class allows to select liveries,

-
insignia, decals, variants, etc. Usually the overlay properties are

-
fed to "select" and "material" animations.

-
SYNOPSIS:

-
OverlaySelector.new(<title>, <dir>, <nameprop> [, <sortprop> [, <mpprop> [, <callback>]]]);

-
title ... dialog title

-
dir ... directory where to find the XML overlay files,

-
relative to FG_ROOT

-
nameprop ... property in an overlay file that contains the name

-
The result is written to this place in the

-
property tree.

-
sortprop ... property in an overlay file that should be used

-
as sorting criterion, if alphabetic sorting by

-
name is undesirable. Use nil if you don't need

-
this, but want to set a callback function.

-
mpprop ... property path of MP node where the file name should

-
be written to

-
callback ... function that's called after a new entry was chosen,

-
with these arguments:

-
callback(<number>, <name>, <sort-criterion>, <file>, <path>)

-
EXAMPLE:

-
aircraft.data.add("sim/model/pilot"); autosave the pilot

-
var pilots_dialog = gui.OverlaySelector.new("Pilots",

-
"Aircraft/foo/Models/Pilots",

-
"sim/model/pilot");

-
pilots_dialog.open(); or ... close(), or toggle()

-
-

gui.OverlaySelector.new ( title, dir, nameprop, sortprop = nil, mpprop = nil, callback = nil )

-
-

gui.OverlaySelector.reinit ( )

-
-

gui.OverlaySelector.del ( )

-
-

gui.OverlaySelector.rescan ( )

-
-

gui.OverlaySelector.set ( index )

-
-

gui.OverlaySelector.select ( name )

-
-

gui.OverlaySelector.next ( )

-
-

gui.OverlaySelector.previous ( )

-
-

gui.FileSelector

-
FileSelector class (derived from Dialog class).

-
SYNOPSIS: FileSelector.new(<callback>, <title>, <button> [, <pattern> [, <dir> [, <file> [, <dotfiles>]]]])

-
callback ... callback function that gets return value as first argument

-
title ... dialog title

-
button ... button text (should say "Save", "Load", etc. and not just "OK")

-
pattern ... array with shell pattern or nil (which is equivalent to "*")

-
dir ... starting dir ($FG_ROOT if unset)

-
file ... pre-selected default file name

-
dotfiles ... flag that decides whether UNIX dotfiles should be shown (1) or not (0)

-
EXAMPLE:

-
var report = func(n) { print("file ", n.getValue(), " selected") }

-
var selector = gui.FileSelector.new(

-
report, callback function

-
"Save Flight", dialog title

-
"Save", button text

-
["*.sav", "*.xml"], pattern for displayed files

-
"/tmp", start dir

-
"flight.sav"); default file name

-
selector.open();

-
selector.close();

-
selector.set_title("Save Another Flight");

-
selector.open();

-
-

gui.FileSelector.new ( callback, title, button, pattern = nil, dir = )

-
-

gui.FileSelector.set_title ( title )

-
setters only take effect after the next call to open()

-
-

gui.FileSelector.set_button ( button )

-
-

gui.FileSelector.set_directory ( dir )

-
-

gui.FileSelector.set_file ( file )

-
-

gui.FileSelector.set_dotfiles ( dot )

-
-

gui.FileSelector.set_pattern ( pattern )

-
-

gui.FileSelector.open ( )

-
-

gui.FileSelector.close ( )

-
-

gui.FileSelector.del ( )

-
-

gui.DirSelector

-
DirSelector - convenience "class" (indeed using a reconfigured FileSelector)

-
-

gui.DirSelector.new ( callback, title, button, dir = )

-
-

gui.save_flight ( )

-
-

gui.load_flight ( )

-
-

gui.set_screenshotdir ( )

-
-

gui.property_browser ( dir = nil )

-
Open property browser with given target path.

-
-

gui.dialog_apply ( dialog, objects... )

-
Apply whole dialog or list of widgets. This copies the widgets'

-
visible contents to the respective <property>.

-
-

gui.dialog_update ( dialog, objects... )

-
Update whole dialog or list of widgets. This makes the widgets

-
adopt and display the value of their <property>.

-
-

gui.enable_widgets ( node, name, enable = 1 )

-
Searches a dialog tree for widgets with a particular <name> entry and

-
sets their <enabled> flag.

-
-

gui.nextStyle ( )

-
GUI theming

-
-

gui.dialog

-
Dialog Boxes

-
-

gui.setWeight ( wgt, opt )

-
-

gui.setWeightOpts ( )

-
Checks the /sim/weight[n]/{selected|opt} values and sets the

-
appropriate weights therefrom.

-
-

gui.weightChangeHandler ( )

-
Called from the F&W dialog when the user selects a weight option

-
-

gui.showWeightDialog ( )

-
-

gui.showHelpDialog ( path, toggle=0 )

-
Dynamically generates a dialog from a help node.

-
gui.showHelpDialog([<path> [, toggle]])

-
path ... path to help node

-
toggle ... decides if an already open dialog should be closed

-
(useful when calling the dialog from a key binding; default: 0)

-
help node

-
each of <title>, <key>, <line>, <text> is optional; uses

-
"/sim/description" or "/sim/aircraft" if <title> is omitted;

-
only the first <text> is displayed

-
<help>

-
<title>dialog title<title>

-
<key>

-
<name>g/G</name>

-
<desc>gear up/down</desc>

-
</key>

-
<line>one line</line>

-
<line>another line</line>

-
<text>text in

-
scrollable widget

-
</text>

-
</help>

-
-

gui.debug_keys

-
-

gui.basic_keys

-
-

gui.common_aircraft_keys

-
-

gui.update_shader_settings ( )

-
overwrite custom shader settings when quality-level is set through the slider

-
in the Rendering Options dialog

-
-
-

io

-

io.readfile ( file )

-
Reads and returns a complete file as a string

-
-

io.basename ( path )

-
basename(<path>), dirname(<path>)

-
Work like standard Unix commands: basename returns the file name from a given

-
path, and dirname returns the directory part.

-
-

io.dirname ( path )

-
-

io.include ( file )

-
include(<filename>)

-
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:

-
io.include("Aircraft/Generic/library.nas");

-
io.include("my_other_file.nas");

-
-

io.load_nasal ( file, module = nil )

-
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.

-
Usage: io.load_nasal(<filename> [, <modulename>]);

-
Example:

-
io.load_nasal(getprop("/sim/fg-root") ~ "/Local/test.nas");

-
io.load_nasal("/tmp/foo.nas", "test");

-
-

io.read_properties ( path, target = nil )

-
Load XML file in FlightGear's native <PropertyList> format.

-
If the second, optional target parameter is set, then the properties

-
are loaded to this node in the global property tree. Otherwise they

-
are returned as a separate props.Node tree. Returns the data as a

-
props.Node on success or nil on error.

-
Usage: io.read_properties(<filename> [, <props.Node or property-path>]);

-
Examples:

-
var target = props.globals.getNode("/sim/model");

-
io.read_properties("/tmp/foo.xml", target);

-
var data = io.read_properties("/tmp/foo.xml", "/sim/model");

-
var data = io.read_properties("/tmp/foo.xml");

-
-

io.read_airport_properties ( icao, fname, target = nil )

-
Load XML file in FlightGear's native <PropertyList> format.

-
file will be located in the airport-scenery directories according to

-
ICAO and filename, i,e in Airports/I/C/A/ICAO.filename.xml

-
If the second, optional target parameter is set, then the properties

-
are loaded to this node in the global property tree. Otherwise they

-
are returned as a separate props.Node tree. Returns the data as a

-
props.Node on success or nil on error.

-
Usage: io.read_airport_properties(<icao>, <filename> [, <props.Node or property-path>]);

-
Examples:

-
var data = io.read_properties("KSFO", "rwyuse");

-
-

io.write_properties ( path, prop )

-
Write XML file in FlightGear's native <PropertyList> format.

-
Returns the filename on success or nil on error. If the source

-
is a props.Node that refers to a node in the main tree, then

-
the data are directly written from the tree, yielding a more

-
accurate result. Otherwise the data need to be copied first,

-
which may slightly change node types (FLOAT becomes DOUBLE etc.)

-
Usage: io.write_properties(<filename>, <props.Node or property-path>);

-
Examples:

-
var data = props.Node.new({ a:1, b:2, c:{ d:3, e:4 } });

-
io.write_properties("/tmp/foo.xml", data);

-
io.write_properties("/tmp/foo.xml", "/sim/model");

-
-

io.readxml ( path, prefix = )

-
The following two functions are for reading generic XML files into

-
the property tree and for writing them from there to the disk. The

-
built-in fgcommands (load, save, loadxml, savexml) are for FlightGear's

-
own <PropertyList> XML files only, as they only handle a limited

-
number of very specific attributes. The io.readxml() loader turns

-
attributes into regular children with a configurable prefix prepended

-
to their name, while io.writexml() turns such nodes back into

-
attributes. The two functions have their own limitations, but can

-
easily get extended to whichever needs. The underlying parsexml()

-
command will handle any XML file.

-
Reads an XML file from an absolute path and returns it as property

-
tree. All nodes will be of type STRING. Data are only written to

-
leafs. Attributes are written as regular nodes with the optional

-
prefix prepended to the name. If the prefix is nil, then attributes

-
are ignored. Returns nil on error.

-
-

io.writexml ( path, node, indent = )

-
Writes a property tree as returned by readxml() to a file. Children

-
with name starting with <prefix> are again turned into attributes of

-
their parent. <node> must contain exactly one child, which will

-
become the XML file's outermost element.

-
-
-

joystick

-

joystick.custom_bindings

-
Hash of the custom axis/buttons

-
-

joystick.Axis

-
Class for an individual joystick axis binding

-
-

joystick.Axis.new ( name, prop, invertable )

-
-

joystick.Axis.clone ( )

-
-

joystick.Axis.match ( prop )

-
-

joystick.Axis.parse ( prop )

-
-

joystick.Axis.readProps ( props )

-
-

joystick.Axis.getName ( )

-
-

joystick.Axis.getBinding ( axis )

-
-

joystick.Axis.isInvertable ( )

-
-

joystick.Axis.isInverted ( )

-
-

joystick.Axis.setInverted ( b )

-
-

joystick.CustomAxis

-
-

joystick.CustomAxis.new ( )

-
-

joystick.CustomAxis.clone ( )

-
-

joystick.CustomAxis.match ( prop )

-
-

joystick.CustomAxis.getBinding ( axis )

-
-

joystick.UnboundAxis

-
-

joystick.UnboundAxis.new ( )

-
-

joystick.UnboundAxis.clone ( )

-
-

joystick.UnboundAxis.match ( prop )

-
-

joystick.UnboundAxis.getBinding ( axis )

-
-

joystick.PropertyScaleAxis

-
-

joystick.PropertyScaleAxis.new ( name, prop, factor=1, offset=0 )

-
-

joystick.PropertyScaleAxis.clone ( )

-
-

joystick.PropertyScaleAxis.match ( prop )

-
-

joystick.PropertyScaleAxis.parse ( p )

-
-

joystick.PropertyScaleAxis.getBinding ( axis )

-
-

joystick.NasalScaleAxis

-
-

joystick.NasalScaleAxis.new ( name, script, prop )

-
-

joystick.NasalScaleAxis.clone ( )

-
-

joystick.NasalScaleAxis.match ( prop )

-
-

joystick.NasalScaleAxis.getBinding ( axis )

-
-

joystick.NasalLowHighAxis

-
-

joystick.NasalLowHighAxis.new ( name, lowscript, highscript, prop, repeatable )

-
-

joystick.NasalLowHighAxis.clone ( )

-
-

joystick.NasalLowHighAxis.match ( prop )

-
-

joystick.NasalLowHighAxis.getBinding ( axis )

-
-

joystick.ButtonBinding

-
Button bindings

-
-

joystick.ButtonBinding.new ( name, binding, repeatable )

-
-

joystick.ButtonBinding.clone ( )

-
-

joystick.ButtonBinding.match ( prop )

-
-

joystick.ButtonBinding.getName ( )

-
-

joystick.ButtonBinding.getBinding ( button )

-
-

joystick.ButtonBinding.isRepeatable ( )

-
-

joystick.CustomButton

-
-

joystick.CustomButton.new ( )

-
-

joystick.CustomButton.clone ( )

-
-

joystick.CustomButton.match ( prop )

-
-

joystick.CustomButton.getBinding ( button )

-
-

joystick.UnboundButton

-
-

joystick.UnboundButton.new ( )

-
-

joystick.UnboundButton.clone ( )

-
-

joystick.UnboundButton.match ( prop )

-
-

joystick.UnboundButton.getBinding ( button )

-
-

joystick.PropertyToggleButton

-
-

joystick.PropertyToggleButton.new ( name, prop )

-
-

joystick.PropertyToggleButton.clone ( )

-
-

joystick.PropertyToggleButton.match ( prop )

-
-

joystick.PropertyToggleButton.getBinding ( button )

-
-

joystick.PropertyAdjustButton

-
-

joystick.PropertyAdjustButton.new ( name, prop, step )

-
-

joystick.PropertyAdjustButton.clone ( )

-
-

joystick.PropertyAdjustButton.match ( prop )

-
-

joystick.PropertyAdjustButton.getBinding ( button )

-
-

joystick.NasalButton

-
-

joystick.NasalButton.new ( name, script, repeatable )

-
-

joystick.NasalButton.clone ( )

-
-

joystick.NasalButton.match ( prop )

-
-

joystick.NasalButton.getBinding ( button )

-
-

joystick.NasalHoldButton

-
-

joystick.NasalHoldButton.new ( name, script, scriptUp )

-
-

joystick.NasalHoldButton.clone ( )

-
-

joystick.NasalHoldButton.match ( prop )

-
-

joystick.NasalHoldButton.getBinding ( button )

-
-

joystick.readConfig ( dialog_root= )

-
Parse config from the /input tree and write it to the

-
dialog_root.

-
-

joystick.writeConfig ( dialog_root= )

-
-

joystick.resetConfig ( dialog_root= )

-
-
-

lag_adjust

-

lag_adjust.mpCheck ( )

-
the compensatelag value are used like that by AIMultiplayer.cxx:

-
1 : old behaviour, trying to keep the plane without doing prediction

-
2 : predict the plane position in the futur

-
3 : display more in the past to avoid predictions

-
-

lag_adjust.mpInit ( )

-
-

lag_adjust.mpClean ( )

-
-

lag_adjust.mpStart ( )

-
-

lag_adjust.masterSwitch ( )

-
-
-

local_weather_auto_init

-

local_weather_auto_init.autoInit ( )

-
this routine checks whether the launcher has requested to auto-start AW

-
we can't do this inside the AW namespace because that is only loaded

-
on demand, and we want this at Nasal (re-)init, not at AW namespace loading

-
Thorsten Renk 2018

-
-
-

material

-

material.colorgroup ( parent, name, base )

-
-

material.mat ( parent, name, path, format, min=nil, max=nil )

-
-

material.showDialog ( base, title=nil, x=nil, y=nil )

-
-
-

math

-

math.abs ( n )

-
-

math.sgn ( x )

-
-

math.max ( x )

-
-

math.min ( x )

-
-

math.avg ( )

-
-

math.clamp ( value, min, max )

-
this follows std::clamp for argument order, as opposed to

-
qBound which uses (min, value, max)

-
-

math.mod ( n, m )

-
note - mathlib defines an fmod function (added after this was written)

-
It uses C-library fmod(), which has different rounding behaviour to

-
this code (eg, fmod(-5, 4) gives -1, whereas this code gives 3)

-
-

math.log10 ( x )

-
-
-

mp_broadcast

-

mp_broadcast.EventChannel

-
Copyright (C) 2008 - 2013 Anders Gidenstam (anders(at)gidenstam.org)

-
This file is licensed under the GPL license version 2 or later.

-
Event broadcast channel using a MP enabled string property.

-
Events from users in multiplayer.ignore are ignored.

-
EventChannel.new(mpp_path)

-
Create a new event broadcast channel. Any MP user with the same

-
primitive will receive all messages sent to the channel from the point

-
she/he joined (barring severe MP packet loss).

-
NOTE: Message delivery is not guaranteed.

-
mpp_path - MP property path : string

-
EventChannel.register(event_hash, handler)

-
Register a handler for the event identified by the hash event_hash.

-
event_hash - hash value for the event : a unique 4 character string

-
handler - a handler function for the event : func (sender, msg)

-
EventChannel.deregister(event_hash)

-
Deregister the handler for the event identified by the hash event_hash.

-
event_hash - hash value for the event : a unique 4 character string

-
EventChannel.send(event_hash, msg)

-
Sends the event event_hash with the message msg to the channel.

-
event_hash - hash value for the event : a unique 4 character string

-
msg - text string with Binary data encoded data : string

-
EventChannel.die()

-
Destroy this EventChannel instance.

-
-

mp_broadcast.EventChannel.new ( mpp_path )

-
-

mp_broadcast.EventChannel.register ( event_hash, - handler )

-
-

mp_broadcast.EventChannel.deregister ( event_hash )

-
-

mp_broadcast.EventChannel.send ( event_hash, - msg )

-
-

mp_broadcast.EventChannel._process ( n, msg )

-
Internals.

-
-

mp_broadcast.BroadcastChannel

-
Broadcast primitive using a MP enabled string property.

-
Broadcasts from users in multiplayer.ignore are ignored.

-
BroadcastChannel.new(mpp_path, process)

-
Create a new broadcast primitive. Any MP user with the same

-
primitive will receive all messages sent to the channel from the point

-
she/he joined (barring severe MP packet loss).

-
NOTE: Message delivery is not guaranteed.

-
mpp_path - MP property path : string

-
process - handler called when receiving a message : func (n, msg)

-
n is the base node of the senders property tree

-
(i.e. /ai/models/multiplay[x])

-
send_to_self - if 1 locally sent messages are : int {0,1}

-
delivered just like remote messages.

-
If 0 locally sent messages are not delivered

-
to the local receiver.

-
accept_predicate - function to select which : func (p)

-
multiplayers to listen to.

-
p is the multiplayer entry node.

-
The default is to accept any multiplayer.

-
on_disconnect - function to be called when an : func (p)

-
accepted MP user leaves.

-
enable_send - Set to 0 to disable sending.

-
BroadcastChannel.send(msg)

-
Sends the message msg to the channel.

-
msg - text string with Binary data encoded data : string

-
BroadcastChannel.die()

-
Destroy this BroadcastChannel instance.

-
-

mp_broadcast.BroadcastChannel.new ( mpp_path, process, - send_to_self = 0, accept_predicate = nil, on_disconnect = nil, enable_send=1 )

-
-

mp_broadcast.BroadcastChannel.send ( msg )

-
-

mp_broadcast.BroadcastChannel.die ( )

-
-

mp_broadcast.BroadcastChannel.start ( )

-
-

mp_broadcast.BroadcastChannel.stop ( )

-
-

mp_broadcast.BroadcastChannel.set_state ( )

-
-

mp_broadcast.BroadcastChannel.update ( )

-
-

mp_broadcast.BroadcastChannel._loop_ ( id )

-
-

mp_broadcast.LamportClock

-
Lamport clock. Useful for creating a total order for events or messages.

-
The users' callsigns are used to break ties.

-
LamportClock.new()

-
Creates a new lamport clock for this user.

-
LamportClock.merge(sender, sender_timestamp)

-
Merges the timestamp from the sender with the local clock.

-
sender : base node of the senders property tree

-
sender_timestamp : the timestamp received from the sender.

-
Returns 1 if the local clock was advanced; 0 otherwise.

-
LamportClock.advance()

-
Advances the local clock one tick.

-
LamportClock.timestamp()

-
Returns an encoded 4 character long timestamp from the local clock.

-
-

mp_broadcast.LamportClock.new ( )

-
LamportClock.new()

-
Creates a new lamport clock for this user.

-
-

mp_broadcast.LamportClock.merge ( sender, sender_timestamp )

-
-

mp_broadcast.LamportClock.advance ( )

-
-

mp_broadcast.LamportClock.timestamp ( )

-
-

mp_broadcast.Binary

-
Some routines for encoding/decoding values into/from a string.

-
NOTE: MP is picky about what it sends in a string propery.

-
Encode 7 bits as a printable 8 bit character.

-
-

mp_broadcast.Binary.encodeInt ( int )

-
-

mp_broadcast.Binary.decodeInt ( str )

-
-

mp_broadcast.Binary.encodeByte ( int )

-
-

mp_broadcast.Binary.decodeByte ( str )

-
-

mp_broadcast.Binary.encodeInt28 ( int )

-
-

mp_broadcast.Binary.decodeInt28 ( str )

-
-

mp_broadcast.Binary.encodeDouble ( d )

-
-

mp_broadcast.Binary.decodeDouble ( str )

-
-

mp_broadcast.Binary.encodeCoord ( coord )

-
-

mp_broadcast.Binary.decodeCoord ( str )

-
Decodes an encoded geo.Coord object.

-
-

mp_broadcast.Binary.stringHash ( str )

-
-

mp_broadcast.Binary.readHash ( str )

-
Decodes an encoded geo.Coord object.

-
-

mp_broadcast.MessageChannel

-
Detects incomming messages encoded in a string property.

-
n - MP source : property node

-
process - action : func (v)

-
NOTE: This is a low level component.

-
The same object is seldom used for both sending and receiving.

-
-

mp_broadcast.MessageChannel.new ( n = nil, process = nil )

-
-

mp_broadcast.MessageChannel.update ( )

-
-

mp_broadcast.MessageChannel.send ( msg )

-
-

mp_broadcast.MessageChannel.new_message_handler ( handler, arg1 )

-
-
-

multikey

-

multikey.start ( )

-
-

multikey.stop ( )

-
-

multikey.handle_key ( key )

-
-

multikey.Dialog

-
-

multikey.Dialog.new ( )

-
-

multikey.Dialog.del ( )

-
-

multikey.Dialog.update ( cmd, title, options )

-
-

multikey.help ( )

-
-

multikey.find_entry ( str, data, result )

-
-

multikey.init ( )

-
-
-

multiplayer

-

multiplayer.lastmsg

-
Multiplayer

-
1) Display chat messages from other aircraft to

-
the screen using screen.nas

-
2) Display a complete history of chat via dialog.

-
3) Allow chat messages to be written by the user.

-
-

multiplayer.ignore

-
-

multiplayer.check_messages ( loop_id )

-
-

multiplayer.echo_message ( callsign, msg )

-
-

multiplayer.timeout_handler ( )

-
-

multiplayer.chat_listener ( n )

-
-

multiplayer.my_kbd_listener ( event )

-
-

multiplayer.capture_kbd ( )

-
-

multiplayer.release_kbd ( )

-
-

multiplayer.compose_message ( msg = )

-
-

multiplayer.end_compose_message ( )

-
-

multiplayer.handle_key ( key )

-
-

multiplayer.dialog

-
-

multiplayer.dialog.init ( x = nil, y = nil )

-
-

multiplayer.dialog.create ( )

-
-

multiplayer.dialog.update ( id )

-
-

multiplayer.dialog._redraw_ ( )

-
-

multiplayer.dialog.toggle_unit ( )

-
-

multiplayer.dialog.toggle_ignore ( callsign )

-
-

multiplayer.dialog.close ( )

-
-

multiplayer.dialog.del ( )

-
-

multiplayer.dialog.show ( )

-
-

multiplayer.dialog.toggle ( )

-
-

multiplayer.dialog.IDCode ( code )

-
-

multiplayer.model

-
Autonomous singleton class that monitors multiplayer aircraft,

-
maintains data in various structures, and raises signal

-
"/sim/signals/multiplayer-updated" whenever an aircraft

-
joined or left. Available data containers are:

-
multiplayer.model.data: hash, key := /ai/models/~ path

-
multiplayer.model.callsign hash, key := callsign

-
multiplayer.model.list vector, sorted alphabetically (ASCII, case insensitive)

-
All of them contain hash entries of this form:

-
{

-
callsign: "BiMaus",

-
path: "Aircraft/bo105/Models/bo105.xml", relative file path

-
root: "/ai/models/multiplayer[4]", root property

-
node: {...}, root property as props.Node hash

-
model: "bo105", model name (extracted from path)

-
sort: "bimaus", callsign in lower case (for sorting)

-
}

-
-

multiplayer.model.init ( )

-
-

multiplayer.model.update ( n = nil )

-
-

multiplayer.model.remove_suffix ( s, x )

-
-

multiplayer.mp_mode_changed ( n )

-
-
-

notifications

-
-

orbital_target

-

orbital_target.orbitalTarget

-
simulation of a faraway orbital target (needs handover to spacecraft-specific

-
code for close range)

-
Thorsten Renk 2016-2019

-
-

orbital_target.orbitalTarget.new ( altitude, inclination, node_longitude, anomaly )

-
-

orbital_target.orbitalTarget.set_anomaly ( anomaly )

-
-

orbital_target.orbitalTarget.set_delta_lon ( dl )

-
-

orbital_target.orbitalTarget.list ( )

-
-

orbital_target.orbitalTarget.evolve ( )

-
-

orbital_target.orbitalTarget.get_inertial_pos ( )

-
-

orbital_target.orbitalTarget.get_inertial_pos_at_time ( time )

-
-

orbital_target.orbitalTarget.get_inertial_speed ( )

-
-

orbital_target.orbitalTarget.get_inertial_speed_at_time ( time )

-
-

orbital_target.orbitalTarget.compute_inertial_pos ( anomaly_rad, nl_rad )

-
-

orbital_target.orbitalTarget.get_latlonalt ( )

-
-

orbital_target.orbitalTarget.start ( )

-
-

orbital_target.orbitalTarget.stop ( )

-
-

orbital_target.orbitalTarget.run ( )

-
-
-

prop_key_handler

-

prop_key_handler.start ( )

-
-

prop_key_handler.stop ( save_history = 0 )

-
-

prop_key_handler.handle_key ( key, shift )

-
-

prop_key_handler.parse_input ( expr )

-
-

prop_key_handler.build_completion ( in )

-
-

prop_key_handler.complete ( in, step )

-
-

prop_key_handler.set_history ( step )

-
-

prop_key_handler.set_color ( r, g, b )

-
-

prop_key_handler.print_prop ( n )

-
-

prop_key_handler.search ( n, s )

-
-
-

props

-

props.Node

-
Node class definition. The class methods simply wrap the

-
low level extension functions which work on a "ghost" handle to a

-
SGPropertyNode object stored in the _g field.

-
Not all of the features of SGPropertyNode are supported. There is

-
no support for ties, obviously, as that wouldn't make much sense

-
from a Nasal context. The various get/set methods work only on the

-
local node, there is no equivalent of the "relative path" variants

-
available in C++; just use node.getNode(path).whatever() instead.

-
-

props.Node.getNode ( wrap )

-
-

props.Node.getParent ( wrap )

-
-

props.Node.getChild ( wrap )

-
-

props.Node.getChildren ( wrap )

-
-

props.Node.setChildren ( wrap )

-
-

props.Node.addChild ( wrap )

-
-

props.Node.addChildren ( wrap )

-
-

props.Node.removeChild ( wrap )

-
-

props.Node.removeChildren ( wrap )

-
-

props.Node.removeAllChildren ( wrap )

-
-

props.Node.getAliasTarget ( wrap )

-
-

props.Node.getName ( _getName )

-
-

props.Node.getIndex ( _getIndex )

-
-

props.Node.getType ( _getType )

-
-

props.Node.getAttribute ( _getAttribute )

-
-

props.Node.setAttribute ( _setAttribute )

-
-

props.Node.getValue ( _getValue )

-
-

props.Node.setValue ( _setValue )

-
-

props.Node.setValues ( _setValues )

-
-

props.Node.setIntValue ( _setIntValue )

-
-

props.Node.setBoolValue ( _setBoolValue )

-
-

props.Node.setDoubleValue ( _setDoubleValue )

-
-

props.Node.unalias ( _unalias )

-
-

props.Node.alias ( n )

-
-

props.Node.equals ( n )

-
-

props.Node.clearValue ( _alias )

-
-

props.Node.getPath ( )

-
-

props.Node.getBoolValue ( )

-
-

props.Node.remove ( )

-
-

props.Node.resolveAlias ( p = nil )

-
follow alias links to "real" node (e.g. where the data is stored)

-
optional argument: property node or prop path to resolve

-
if no argument is given, operate on current obj ("me")

-
-

props.Node.new ( values = nil )

-
Static constructor for a Node object. Accepts a Nasal hash

-
expression to initialize the object a-la setValues().

-
-

props.Node.getValues ( )

-
Counter piece of setValues(). Returns a hash with all values

-
in the subtree. Nodes with same name are returned as vector,

-
where the original node indices are lost. The function should

-
only be used if all or almost all values are needed, and never

-
in performance-critical code paths. If it's called on a node

-
without children, then the result is equivalent to getValue().

-
-

props.Node.initNode ( path = nil, value = 0, type = nil, force = 0 )

-
Initializes property if it's still undefined. First argument

-
is a property name/path. It can also be nil or an empty string,

-
in which case the node itself gets initialized, rather than one

-
of its children. Second argument is the default value. The third,

-
optional argument is a property type (one of "STRING", "DOUBLE",

-
"INT", or "BOOL"). If it is omitted, then "DOUBLE" is used for

-
numbers, and STRING for everything else. Returns the property

-
as props.Node. The fourth optional argument enforces a type if

-
non-zero.

-
-

props.dump ( )

-
Useful debugging utility. Recursively dumps the full state of a

-
Node object to the console. Try binding "props.dump(props.globals)"

-
to a key for a fun hack.

-
-

props.copy ( src, dest, attr = 0 )

-
Recursively copy property branch from source Node to

-
destination Node. Doesn't copy aliases. Copies attributes

-
if optional third argument is set and non-zero.

-
-

props.wrap ( node )

-
Utility. Turns any ghosts it finds (either solo, or in an

-
array) into Node objects.

-
-

props.wrapNode ( node )

-
Utility. Returns a new object with its superclass/parent set to the

-
Node object and its _g (ghost) field set to the specified object.

-
Nasal's literal syntax can be pleasingly terse. I like that. :)

-
-

props.getNode ( return call )

-
Shortcut for props.globals.getNode().

-
-

props.setAll ( base, child, value )

-
Sets all indexed property children to a single value. arg[0]

-
specifies a property name (e.g. /controls/engines/engine), arg[1] a

-
path under each node of that name to set (e.g. "throttle"), arg[2]

-
is the value.

-
-

props.nodeList ( )

-
Turns about anything into a list of props.Nodes, including ghosts,

-
path strings, vectors or hashes containing, as well as functions

-
returning any of the former and in arbitrary nesting. This is meant

-
to be used in functions whose main purpose is to handle collections

-
of properties.

-
-

props.compileCondition ( p )

-
Compiles a <condition> property branch according to the rules

-
set out in $FG_ROOT/Docs/README.conditions into a Condition object.

-
The 'test' method of the returend object can be used to evaluate

-
the condition.

-
The function returns nil on error.

-
-

props.condition ( p )

-
Evaluates a <condition> property branch according to the rules

-
set out in $FG_ROOT/Docs/README.conditions. Undefined conditions

-
and a nil argument are "true". The function dumps the condition

-
branch and returns nil on error.

-
-

props._cond_and ( p )

-
-

props._cond_or ( p )

-
-

props._cond ( p )

-
-

props._cond_cmp ( p, op )

-
-

props.runBinding ( node, module = nil )

-
Runs <binding> as described in $FG_ROOT/Docs/README.commands using

-
a given module by default, and returns 1 if fgcommand() succeeded,

-
or 0 otherwise. The module name won't override a <module> defined

-
in the binding.

-
-

props.Node._updateProperty ( _property )

-
-

props.Node.FromProperty ( _propname, _delta, _changed_method )

-
-

props.Node.IsNumeric ( hashkey )

-
-

props.Node.FromPropertyHashList ( _keylist, _delta, _changed_method )

-
-

props.Node.FromHashValue ( _key, _delta, _changed_method )

-
-

props.Node.FromHashList ( _keylist, _delta, _changed_method )

-
-
-

redout

-

redout.run ( )

-
-
-

route_manager

-

route_manager.RouteManagerDelegate

-
route_manager.nas - FlightPlan delegate(s) corresponding to the built-

-
in route-manager dialog and GPS. Intended to provide a sensible default behaviour,

-
but can be disabled by an aircraft-specific FMS / GPS system.

-
-

route_manager.RouteManagerDelegate.new ( fp )

-
-

route_manager.RouteManagerDelegate.departureChanged ( )

-
-

route_manager.RouteManagerDelegate.arrivalChanged ( )

-
-

route_manager.RouteManagerDelegate.cleared ( )

-
-

route_manager.RouteManagerDelegate.endOfFlightPlan ( )

-
-

route_manager.FMSDelegate

-
-

route_manager.FMSDelegate.new ( fp )

-
-

route_manager.FMSDelegate._landingCheckTimeout ( )

-
-

route_manager.FMSDelegate.waypointsChanged ( )

-
-

route_manager.FMSDelegate.endOfFlightPlan ( )

-
-

route_manager.FMSDelegate.currentWaypointChanged ( )

-
-
-

scenery

-

scenery.sharedDoor

-
An extended aircraft.door that transmits the door events over MP using the

-
scenery.events channel.

-
Use only for single instance objects (e.g. static scenery objects).

-
Note: Currently toggle() is the only shared event.

-
-

scenery.sharedDoor.new ( node, swingtime, pos = 0 )

-
-

scenery.sharedDoor.toggle ( )

-
-

scenery.sharedDoor.destroy ( )

-
-

scenery.sharedDoor._process ( sender, msg )

-
-

scenery.sharedDoor._loop ( id )

-
-

scenery._set_state ( )

-
-
-

screen

-

screen.sanitize ( s, newline = 0 )

-
on-screen displays

-
convert string for output; replaces tabs by spaces, and skips

-
delimiters and the voice part in "{text|voice}" constructions

-
-

screen.window

-
screen.window

-
------------------------------------------------------------------------------

-
Class that manages a dialog with fixed number of lines, where you can push in

-
text at the bottom, which then (optionally) scrolls up after some time.

-
simple use:

-
var window = screen.window.new();

-
window.write("message in the middle of the screen");

-
advanced use:

-
var window = screen.window.new(nil, -100, 3, 10);

-
window.fg = [1, 1, 1, 1]; choose white default color

-
window.align = "left";

-
window.write("first line");

-
window.write("second line (red)", 1, 0, 0);

-
arguments:

-
x ... x coordinate

-
y ... y coordinate

-
positive coords position relative to the left/lower corner,

-
negative coords from the right/upper corner, nil centers

-
maxlines ... max number of displayed lines; if more are pushed into the

-
screen, then the ones on top fall off

-
autoscroll ... seconds that each line should be shown; can be less if

-
a message falls off; if 0 then don't scroll at all

-
-

screen.window.new ( x = nil, y = nil, maxlines = 10, autoscroll = 10 )

-
-

screen.window.write ( msg, r = nil, g = nil, b = nil, a = nil )

-
-

screen.window.clear ( )

-
-

screen.window.show ( )

-
-

screen.window.close ( )

-
-

screen.window._write_ ( )

-
-

screen.window._timeout_ ( )

-
-

screen.window._redraw_ ( )

-
-

screen.display

-
Class that manages a dialog, which displays an arbitrary number of properties

-
periodically updating the values. Property names are abbreviated to the

-
shortest possible unique part.

-
Example:

-
var dpy = screen.display.new(20, 10); x/y coordinate

-
dpy.setcolor(1, 0, 1); magenta (default: white)

-
dpy.setfont("SANS_12B",12); see $FG_ROOT/gui/styles/*.xml

-
dpy.add("/position/latitude-deg", "/position/longitude-deg");

-
dpy.add(props.globals.getNode("/orientation").getChildren());

-
The add() method takes one or more property paths or props.Nodes, or a vector

-
containing those, or a hash with properties, or vectors with properties, etc.

-
Internal "public" parameters may be set directly:

-
dpy.interval = 0; update every frame

-
dpy.format = "%.3g"; max. 3 digits fractional part

-
dpy.tagformat = "%-12s"; align prop names to 12 spaces

-
dpy.redraw(); pick up new settings

-
The open() method should only be used to undo a close() call. In all other

-
cases this is done implicitly. redraw() is automatically called by an add(),

-
but can be used to let the dialog pick up new settings of internal variables.

-
Methods add(), setfont() and setcolor() can be appended to the new()

-
constructor (-> show big yellow frame rate counter in upper right corner):

-
screen.display.new(-15, -5, 0).setfont("TIMES_24").setcolor(1, 0.9, 0).add("/sim/frame-rate");

-
-

screen.display.new ( x, y, show_tags = 1 )

-
-

screen.display.setcolor ( r, g, b, a = 1 )

-
-

screen.display.setfont ( font, size=13 )

-
-

screen.display._create_ ( )

-
-

screen.display.open ( )

-
add() opens already, so call open() explicitly only after close()!

-
-

screen.display.close ( )

-
-

screen.display.toggle ( )

-
-

screen.display.reset ( )

-
-

screen.display.redraw ( )

-
-

screen.display.add ( p... )

-
-

screen.display.update ( )

-
-

screen.display._loop_ ( id )

-
-

screen.display.nameof ( n )

-
-

screen.listener

-
-

screen.search_name_in_msg ( msg, call )

-
-

screen.msg_mp ( n )

-
functions that make use of the window class (and don't belong anywhere else)

-
highlights messages with the multiplayer callsign in the text

-
-

screen.msg_repeat ( )

-
-
-

seaport

-
-

string

-

string.iscntrl ( c )

-
-

string.isascii ( c )

-
-

string.isupper ( c )

-
-

string.islower ( c )

-
-

string.isdigit ( c )

-
-

string.isblank ( c )

-
-

string.ispunct ( c )

-
-

string.isxdigit ( c )

-
-

string.isspace ( c )

-
-

string.isalpha ( c )

-
-

string.isalnum ( c )

-
-

string.isgraph ( c )

-
-

string.isprint ( c )

-
-

string.toupper ( c )

-
-

string.tolower ( c )

-
-

string.isxspace ( c )

-
-

string.trim ( s, lr = 0, istrim = nil )

-
trim spaces at the left (lr < 0), at the right (lr > 0), or both (lr = 0)

-
An optional function argument defines which characters should be trimmed:

-
string.trim(a); trim spaces

-
string.trim(a, 1, string.isdigit); trim digits at the right

-
string.trim(a, 0, func(c) c == `\\` or c == `/`); trim slashes/backslashes

-
-

string.truncateAt ( src, match )

-
truncate at the first match

-
string.truncateAt("file.xml", ".xml"); "file.xml" -> "file"

-
string.truncateAt("file.xml", ".txt"); "file.xml" -> "file.xml"

-
-

string.lc ( str )

-
return string converted to lower case letters

-
-

string.uc ( str )

-
return string converted to upper case letters

-
-

string.icmp ( a, b )

-
case insensitive string compare and match functions

-
(not very efficient -- converting the array to be sorted

-
first is faster)

-
-

string.imatch ( a, b )

-
-

string.compileTemplate ( template, type=nil )

-
Get a function out of a string template for fast insertion of template

-
parameters. This allows to use the same templates as with most available tile

-
mapping engines (eg. Leaflet, Polymaps). Return a callable function object on

-
success, and nil if parsing the templated fails. See string._template_getargs

-
for more on calling a compile object.

-
Example (Build MapQuest tile url):

-
var makeUrl = string.compileTemplate(

-
"http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg"

-
);

-
print( makeUrl({x: 5, y: 4, z: 3}) );

-
Output:

-
http://otile1.mqcdn.com/tiles/1.0.0/map/3/5/4.jpg

-
-

string._template_getargs ( )

-
Private function used by string.naCompileTemplate. Expands any __ENV parameter

-
into the locals of the caller. This allows both named arguments and manual hash

-
arguments via __ENV.

-
Examples using (format = func(__ENV) {string._template_getargs()}):

-
Pass arguments as hash:

-
format({a: 1, "b ":2});

-
Or:

-
format(__ENV:{a: 1, "b ":2});

-
Pass arguments as named:

-
format(a: 1, "b ":2);

-
Pass arguments as both named and hash, using

-
__ENV to specify the latter:

-
format(a: 1, __ENV:{"b ": 2});

-
-

string.Scan

-
Simple scanf function. Takes an input string, a pattern, and a

-
vector. It returns 0 if the format didn't match, and appends

-
all found elements to the given vector. Return values:

-
-1 string matched format ending with % (i.e. more chars than format cared about)

-
0 string didn't match format

-
1 string matched, but would still match if the right chars were added

-
2 string matched, and would not if any character would be added

-
var r = string.scanf("comm3freq123.456", "comm%ufreq%f", var result = []);

-
The result vector will be set to [3, 123.456].

-
-

string.Scan.new ( s )

-
-

string.Scan.getc ( )

-
-

string.Scan.ungetc ( )

-
-

string.Scan.rest ( )

-
-

string.scanf ( test, format, result )

-
-

string.setcolors ( enabled )

-
ANSI colors (see $ man console_codes)

-
-

string.color ( color, s, enabled=nil )

-
-
-

tanker

-

tanker.oclock ( bearing )

-
--------------------------------------------------------------------------------------------------

-
-

tanker.tanker_msg ( setprop )

-
-

tanker.pilot_msg ( setprop )

-
-

tanker.atc_msg ( setprop )

-
-

tanker.skip_cloud_layer ( alt )

-
-

tanker.identity

-
-

tanker.identity.get ( )

-
-

tanker.Tanker

-
-

tanker.Tanker.new ( aiid, callsign, tacan, type, model, kias, maxfuel, pattern, contacts, heading, coord )

-
-

tanker.Tanker.del ( )

-
-

tanker.Tanker.update ( )

-
-

tanker.Tanker.identify ( )

-
-

tanker.Tanker.report ( )

-
-

tanker.create_tanker ( tanker_node, course )

-
Factory methods

-
Create a tanker based on a given /sim/ai/tankers/tanker property node

-
-

tanker.request_new ( tanker_node=nil )

-
Request a new tanker

-
-

tanker.request ( tanker_node=nil )

-
-

tanker.request_random ( tanker_node=nil )

-
-

tanker.report ( )

-
-

tanker.reinit ( )

-
-
-

track_target

-

track_target.TrackInit ( )

-
Initialize target tracking

-
-

track_target.TrackUpdate ( loop_id )

-
If enabled, update our AP target values based on the target range,

-
bearing, and speed

-
-
-

video

-

video.save ( )

-
print("A");

-
-
-

view

-

view.hasmember ( class, member )

-
-

view.calcMul ( )

-
-

view.increase ( )

-
Handler. Increase FOV by one step

-
-

view.decrease ( )

-
Handler. Decrease FOV by one step

-
-

view.resetFOV ( )

-
Handler. Reset FOV to default.

-
-

view.resetViewPos ( )

-
-

view.resetViewDir ( )

-
-

view.stepView ( step, force = 0 )

-
Handler. Step to the next (force=1) or next enabled view.

-
-

view.indexof ( name )

-
Get view index by name.

-
-

view.panViewDir ( step )

-
Pans the view horizontally. The argument specifies a relative rate

-
(or number of "steps" -- same thing) to the standard rate.

-
-

view.panViewPitch ( step )

-
Pans the view vertically. The argument specifies a relative rate

-
(or number of "steps" -- same thing) to the standard rate.

-
-

view.resetView ( )

-
Reset view to default using current view manager (see default_handler).

-
-

view.default_handler

-
Default view handler used by view.manager.

-
-

view.default_handler.reset ( )

-
-

view.manager

-
View manager. Administrates optional Nasal view handlers.

-
Usage: view.manager.register(<view-id>, <view-handler>);

-
view-id: the view's name (e.g. "Chase View") or index number

-
view-handler: a hash with any combination of the functions listed in the

-
following example, or none at all. Only define the interface

-
functions that you really need! The hash may contain local

-
variables and other, non-interface functions.

-
Example:

-
var some_view_handler = {

-
init : func {}, called only once at startup

-
start : func {}, called when view is switched to our view

-
stop : func {}, called when view is switched away from our view

-
reset : func {}, called with view.resetView()

-
update : func { 0 }, called iteratively if defined. Must return

-
}; interval in seconds until next invocation

-
Don't define it if you don't need it!

-
view.manager.register("Some View", some_view_handler);

-
-

view.manager.init ( )

-
-

view.manager.register ( which, handler = nil )

-
-

view.manager.set_view ( which = nil )

-
-

view.manager.reset ( )

-
-

view.manager._loop_ ( id )

-
-

view.fly_by_view_handler

-
-

view.fly_by_view_handler.init ( )

-
-

view.fly_by_view_handler.start ( )

-
-

view.fly_by_view_handler.reset ( )

-
-

view.fly_by_view_handler.setpos ( force = 0 )

-
-

view.fly_by_view_handler.update ( )

-
-

view.model_view_handler

-
-

view.model_view_handler.init ( node )

-
-

view.model_view_handler.start ( )

-
-

view.model_view_handler.stop ( )

-
-

view.model_view_handler.reset ( )

-
-

view.model_view_handler.find ( callsign )

-
-

view.model_view_handler.select ( which, by_callsign=0 )

-
-

view.model_view_handler.next ( step )

-
-

view.model_view_handler._update_ ( )

-
-

view.model_view_handler.setup ( data )

-
-

view.pilot_view_limiter

-
-

view.pilot_view_limiter.new ( )

-
-

view.pilot_view_limiter.init ( )

-
-

view.pilot_view_limiter.start ( )

-
-

view.pilot_view_limiter.update ( )

-
-

view.panViewDir ( step )

-
-

view.normdeg ( a )

-
Saves/restores/moves the view point (position, orientation, field-of-view).

-
Moves are interpolated with sinusoidal characteristic. There's only one

-
instance of this class, available as "view.point".

-
Usage:

-
view.point.save(); ... save current view and return reference to

-
saved values in the form of a props.Node

-
view.point.restore(); ... restore saved view parameters

-
view.point.move(<prop> [, <time>]);

-
... set view parameters from a props.Node with

-
optional move time in seconds. <prop> may be

-
nil, in which case nothing happens.

-
A parameter set as expected by set() and returned by save() is a props.Node

-
object containing any (or none) of these children:

-
<heading-offset-deg>

-
<pitch-offset-deg>

-
<roll-offset-deg>

-
<x-offset-m>

-
<y-offset-m>

-
<z-offset-m>

-
<field-of-view>

-
<move-time-sec>

-
The <move-time> isn't really a property of the view, but is available

-
for convenience. The time argument in the move() method overrides it.

-
Normalize angle to -180 <= angle < 180

-
-

view.ViewAxis

-
Manages one translation/rotation axis. (For simplicity reasons the

-
field-of-view parameter is also managed by this class.)

-
-

view.ViewAxis.new ( prop )

-
-

view.ViewAxis.reset ( )

-
-

view.ViewAxis.target ( v )

-
-

view.ViewAxis.move ( blend )

-
-

view.point

-
view.point: handles smooth view movements

-
-

view.point.init ( )

-
-

view.point.save ( )

-
-

view.point.restore ( )

-
-

view.point.move ( prop, time = nil )

-
-

view.point._loop_ ( id, time )

-
-

view.screenWidthCompens

-
view.ScreenWidthCompens: optional FOV compensation for wider screens.

-
It keeps an equivalent of 55° FOV on a 4:3 zone centered on the screen

-
whichever is the screen width/height ratio. Works only if width >= height.

-
-

view.screenWidthCompens.getStatus ( me.statusNode.getValue )

-
-

view.screenWidthCompens.setStatus ( state )

-
-

view.screenWidthCompens.getDimensions ( )

-
-

view.screenWidthCompens.calcNewFov ( fov=55, oldW=nil, oldH=nil, w=nil, h=nil )

-
-

view.screenWidthCompens.init ( )

-
-

view.screenWidthCompens.toggle ( )

-
-

view.screenWidthCompens.update ( opt=nil, force=0 )

-
-
-

volcano

-

volcano.volcano

-
-

volcano.volcano.new ( name, lat, lon )

-
-

volcano.volcano_manager

-
-

volcano.volcano_manager.init ( )

-
-

volcano.volcano_manager.start ( )

-
-

volcano.volcano_manager.init_state ( )

-
-

volcano.volcano_manager.set_state ( )

-
-

volcano.volcano_manager.run ( index )

-
-

volcano.set_kilauea ( )

-
setter functions for volcano sceneries

-
-

volcano.set_stromboli ( )

-
-

volcano.set_etna ( )

-
-

volcano.set_beerenberg ( )

-
-
-

weather_scenario

-

weather_scenario.initialize_weather_scenario ( )

-
-
-

wildfire

-

wildfire.trace ( )

-
A cellular automaton forest fire model with the ability to

-
spread over the multiplayer network.

-
Copyright (C) 2007 - 2012 Anders Gidenstam (anders(at)gidenstam.org)

-
This file is licensed under the GPL license version 2 or later.

-
The cellular automata model used here is loosely based on

-
A. Hernandez Encinas, L. Hernandez Encinas, S. Hoya White,

-
A. Martin del Rey, G. Rodriguez Sanchez,

-
"Simulation of forest fire fronts using cellular automata",

-
Advances in Engineering Software 38 (2007), pp. 372-378, Elsevier.

-
Set this to print for debug.

-
-

wildfire.ignite ( pos, source=1 )

-
External API

-
Start a fire.

-
pos - fire location : geo.Coord

-
source - broadcast event? : bool

-
-

wildfire.resolve_water_drop ( pos, radius, volume, source=1 )

-
Resolve a water drop impact.

-
pos - drop location : geo.Coord

-
radius - drop radius m : double

-
volume - drop volume m3 : double

-
-

wildfire.resolve_retardant_drop ( pos, radius, volume, source=1 )

-
Resolve a retardant drop impact.

-
pos - drop location : geo.Coord

-
radius - drop radius : double

-
volume - drop volume : double

-
-

wildfire.resolve_foam_drop ( pos, radius, volume, source=1 )

-
Resolve a foam drop impact.

-
pos - drop location : geo.Coord

-
radius - drop radius : double

-
volume - drop volume : double

-
-

wildfire.load_event_log ( filename, skip_ahead_until )

-
Load an event log.

-
skip_ahead_until - skip from last event to this time : double (epoch)

-
fast forward from skip_ahead_until

-
to current time.

-
x < last event - fast forward all the way to current time (use 0).

-
NOTE: Can be VERY time consuming.

-
-1 - skip to current time.

-
-

wildfire.save_event_log ( filename )

-
Save an event log.

-
-

wildfire.print_score ( )

-
Print current score summary.

-
-

wildfire.mp_last_limited_event

-
-

wildfire.score_report_loop ( )

-
Utility functions.

-
-

wildfire.ignition_msg ( pos )

-
MP messages

-
-

wildfire.water_drop_msg ( pos, radius, volume )

-
-

wildfire.retardant_drop_msg ( pos, radius, volume )

-
-

wildfire.foam_drop_msg ( pos, radius, volume )

-
-

wildfire.parse_msg ( source, msg )

-
-

wildfire.SimTime

-
Simulation time management.

-
NOTE: Time warp is ignored for the time being.

-
-

wildfire.SimTime.init ( )

-
-

wildfire.SimTime.current_time ( )

-
-

wildfire.FireCell

-
Class that maintains the state of one fire cell.

-
-

wildfire.FireCell.new ( x, y )

-
-

wildfire.FireCell.ignite ( )

-
-

wildfire.FireCell.extinguish ( type= )

-
-

wildfire.FireCell.update ( )

-
-

wildfire.FireCell.get_neighbour_burn ( create )

-
Get neightbour burn values.

-
-

wildfire.CellModel

-
Class that maintains the 3d model(s) for one fire cell.

-
-

wildfire.CellModel.new ( x, y, alt )

-
-

wildfire.CellModel.set_type ( type )

-
-

wildfire.CellModel.remove ( )

-
-

wildfire.CAFireModels

-
Singleton that maintains the CA models.

-
-

wildfire.CAFireModels.init ( )

-
Public operations

-
-

wildfire.CAFireModels.reset ( enabled )

-
Reset the model grid to the empty state.

-
-

wildfire.CAFireModels.start ( )

-
Start the CA model grid.

-
-

wildfire.CAFireModels.stop ( )

-
Stop the CA model grid.

-
Note that it will catch up lost time when started again.

-
-

wildfire.CAFireModels.add ( x, y, alt )

-
Add a new cell model.

-
-

wildfire.CAFireModels.set_type ( x, y, type )

-
Update a cell model.

-
-

wildfire.CAFireModels.set_models_enabled ( on=1 )

-
-

wildfire.CAFireModels.update ( )

-
Private operations

-
-

wildfire.CAFire

-
Singleton that maintains the fire cell CA grid.

-
-

wildfire.CAFire.init ( )

-
Public operations

-
-

wildfire.CAFire.reset ( enabled, sim_time )

-
Reset the CA to the empty state and set its current time to sim_time.

-
-

wildfire.CAFire.start ( )

-
Start the CA.

-
-

wildfire.CAFire.stop ( )

-
Stop the CA. Note that it will catch up lost time when started again.

-
-

wildfire.CAFire.ignite ( lat, lon )

-
Start a fire in the cell at pos.

-
-

wildfire.CAFire.resolve_water_drop ( lat, lon, radius, volume=0 )

-
Resolve a water drop.

-
For now: Assume that water makes the affected cell nonflammable forever

-
and extinguishes it if burning.

-
radius - meter : double

-
Note: volume is unused ATM.

-
-

wildfire.CAFire.resolve_retardant_drop ( lat, lon, radius, volume=0 )

-
Resolve a fire retardant drop.

-
For now: Assume that the retardant makes the affected cell nonflammable

-
forever and extinguishes it if burning.

-
Note: volume is unused ATM.

-
-

wildfire.CAFire.resolve_foam_drop ( lat, lon, radius, volume=0 )

-
Resolve a foam drop.

-
For now: Assume that water makes the affected cell nonflammable forever

-
and extinguishes it if burning.

-
radius - meter : double

-
Note: volume is unused ATM.

-
-

wildfire.CAFire.save_event_log ( filename )

-
Save the current event log.

-
This is modelled on Melchior FRANZ's ac_state.nas.

-
-

wildfire.CAFire.load_event_log ( filename, skip_ahead_until )

-
Load an event log.

-
skip_ahead_until - skip from last event to this time : double (epoch)

-
fast forward from skip_ahead_until

-
to current time.

-
x < last event - fast forward all the way to current time (use 0).

-
-1 - skip to current time.

-
-

wildfire.CAFire.get_cell ( x, y )

-
Internal operations

-
-

wildfire.CAFire.set_cell ( x, y, cell )

-
-

wildfire.CAFire.update ( )

-
-

wildfire.CAFire.loop ( )

-
-

wildfire.time_string_to_epoch ( time )

-
Utility functions

-
Convert a time string in the format yyyy[:mm[:dd[:hh[:mm[:ss]]]]]

-
to seconds since 1970:01:01:00:00:00.

-
Note: This is an over simplified approximation.

-
-

wildfire.dialog

-
-

wildfire.dialog.init ( x = nil, y = nil )

-
-

wildfire.dialog.create ( )

-
-

wildfire.dialog.close ( )

-
-

wildfire.dialog.destroy ( )

-
-

wildfire.dialog.show ( )

-
-

wildfire.dialog.select_and_load ( )

-
-
-

windsock

-

windsock.windsock ( )

-
-
-

FailureMgr

-

FailureMgr.FailureMode

-
Represents one way things can go wrong, for example "a blown tire".

-
-

FailureMgr.FailureMode.new ( id, description, actuator )

-
id: Unique identifier for this failure mode.

-
eg: "engine/carburetor-ice"

-
description: Short text description, suitable for printing to the user.

-
eg: "Ice in the carburetor"

-
actuator: Object implementing the FailureActuator interface.

-
Used by the failure manager to apply a certain level of

-
failure to the failure mode.

-
-

FailureMgr.FailureMode.set_failure_level ( level )

-
Applies a certain level of failure to this failure mode.

-
level: Floating point number in the range [0, 1] zero being no failure

-
and 1 total failure.

-
-

FailureMgr.FailureMode._set_failure_level ( level )

-
Internal version that actually does the job.

-
-

FailureMgr.FailureMode.get_failure_level ( me.actuator.get_failure_level )

-
Returns the level of failure currently being simulated.

-
-

FailureMgr.FailureMode.bind ( path )

-
Creates an interface for this failure mode in the property tree at the

-
given location. Currently the interface is just:

-
path/failure-level (double, rw)

-
-

FailureMgr.FailureMode.unbind ( )

-
Remove bound properties from the property tree.

-
-

FailureMgr._failmgr

-
Implements the FailureMgr functionality.

-
It is wrapped into an object to leave the door open to several evolution

-
approaches, for example moving the implementation down to the C++ engine.

-
Additionally, it also serves to isolate implementation details into its own

-
namespace.

-
-

FailureMgr._failmgr.init ( )

-
-

FailureMgr._failmgr.add_failure_mode ( mode )

-
-

FailureMgr._failmgr.get_failure_modes ( )

-
-

FailureMgr._failmgr.remove_failure_mode ( id )

-
-

FailureMgr._failmgr.remove_all ( )

-
-

FailureMgr._failmgr.repair_all ( )

-
-

FailureMgr._failmgr.set_trigger ( mode_id, trigger )

-
-

FailureMgr._failmgr.get_trigger ( mode_id )

-
-

FailureMgr._failmgr.on_trigger_activated ( trigger )

-
Observer interface. Called from asynchronous triggers when they fire.

-
trigger: Reference to the firing trigger.

-
-

FailureMgr._failmgr._enable ( )

-
Enable the failure manager. Starts the trigger poll timer and enables

-
all triggers.

-
Called from /sim/failure-manager/enabled and during a teleport if the

-
FM was enabled when the teleport was initiated.

-
-

FailureMgr._failmgr._disable ( )

-
Suspends failure manager activity. Pollable triggers will not be updated

-
and all triggers will be disabled.

-
Called from /sim/failure-manager/enabled and during a teleport.

-
-

FailureMgr._failmgr.enabled ( )

-
-

FailureMgr._failmgr.log ( message )

-
-

FailureMgr._failmgr._update ( )

-
Poll loop. Updates pollable triggers and applies a failure level

-
when they fire.

-
-

FailureMgr._failmgr._discard_trigger ( trigger )

-
-

FailureMgr._failmgr._on_teleport ( pnode )

-
Teleport listener. During repositioning, all triggers are disabled to

-
avoid them firing in a possibly inconsistent state.

-
-

FailureMgr._failmgr.dump_status ( mode_ids=nil )

-
-

FailureMgr._init ( )

-
Module initialization

-
-

FailureMgr.events

-
Nasal modules can subscribe to FailureMgr events.

-
Each event has an independent dispatcher so modules can subscribe only to

-
the events they are interested in. This also simplifies processing at client

-
side by being able to subscibe different callbacks to different events.

-
Example:

-
var handle = FailureMgr.events["trigger-fired"].subscribe(my_callback);

-
-

FailureMgr.get_id ( category, failure_mode )

-
Encodes a pair "category" and "failure_mode" into a "mode_id".

-
These just have the simple form "category/mode", and are used to refer to

-
failure modes throughout the FailureMgr API and to create a path within the

-
sim/failure-manager property tree for the failure mode.

-
examples of categories:

-
structural, instrumentation, controls, sensors, etc...

-
examples of failure modes:

-
altimeter, pitot, left-tire, landing-light, etc...

-
-

FailureMgr.split_id ( mode_id )

-
Returns a vector containing: [category, failure_mode]

-
-

FailureMgr.add_failure_mode ( id, description, actuator )

-
Subscribe a new failure mode to the system.

-
id: Unique identifier for this failure mode.

-
eg: "engine/carburetor-ice"

-
description: Short text description, suitable for printing to the user.

-
eg: "Ice in the carburetor"

-
actuator: Object implementing the FailureActuator interface.

-
Used by the failure manager to apply a certain level of

-
failure to the failure mode.

-
-

FailureMgr.get_failure_modes ( )

-
Returns a vector with all failure modes in the system.

-
Each vector entry is a hash with the following keys:

-
{ id, description }

-
-

FailureMgr.remove_failure_mode ( id )

-
Remove a failure mode from the system.

-
id: FailureMode id string, e.g. "systems/pitot"

-
-

FailureMgr.remove_all ( )

-
Removes all failure modes from the failure manager.

-
-

FailureMgr.set_trigger ( mode_id, trigger )

-
Attaches a trigger to the given failure mode. Discards the current trigger

-
if any.

-
mode_id: FailureMode id string, e.g. "systems/pitot"

-
trigger: Trigger object or nil. Nil will just detach the current trigger

-
-

FailureMgr.get_trigger ( mode_id )

-
Returns the trigger object attached to the given failure mode.

-
mode_id: FailureMode id string, e.g. "systems/pitot"

-
-

FailureMgr.set_failure_level ( mode_id, level )

-
Applies a certain level of failure to this failure mode.

-
mode_id: Failure mode id string.

-
level: Floating point number in the range [0, 1]

-
Zero represents no failure and one means total failure.

-
-

FailureMgr.get_failure_level ( mode_id )

-
Returns the current failure level for the given failure mode.

-
mode_id: Failure mode id string.

-
-

FailureMgr.repair_all ( )

-
Restores all failure modes to level = 0

-
-

FailureMgr.get_log_buffer ( )

-
Returns a vector of timestamped failure manager events, such as the

-
messages shown in the console when there are changes to the failure conditions.

-
Each entry in the vector has the following format:

-
{ time: <time stamp>, message: <event description> }

-
-

FailureMgr.enable ( setprop )

-
Allows applications to disable the failure manager and restore it later on.

-
While disabled, no failure modes will be activated from the failure manager.

-
-

FailureMgr.disable ( setprop )

-
-

FailureMgr.Trigger

-
Encapsulates a condition that when met, will make the failure manager to

-
apply a certain level of failure to the failure mode it is bound to.

-
Two types of triggers are supported: pollable and asynchronous.

-
Pollable triggers require periodic check for trigger conditions. For example,

-
an altitude trigger will need to poll current altitude until the fire

-
condition is reached.

-
Asynchronous trigger do not require periodic updates. They can detect

-
the firing condition by themselves by using timers or listeners.

-
Async triggers must call the inherited method on_fire() to let the Failure

-
Manager know about the fired condition.

-
See Aircraft/Generic/Systems/failures.nas for concrete examples of triggers.

-
-

FailureMgr.Trigger.new ( )

-
-

FailureMgr.Trigger.on_fire ( 0, - )

-
Async triggers shall call the on_fire() callback when their fire

-
conditions are met to notify the failure manager.

-
-

FailureMgr.Trigger.update ( 0, - )

-
Forces a check of the firing conditions. Returns 1 if the trigger fired,

-
0 otherwise.

-
-

FailureMgr.Trigger.to_str ( )

-
Returns a printable string describing the trigger condition.

-
-

FailureMgr.Trigger.set_param ( param, value )

-
Modify a trigger parameter. Parameters will take effect after the next

-
call to reset()

-
-

FailureMgr.Trigger.arm ( )

-
Load trigger parameters and reset internal state. Once armed, the trigger

-
will fire as soon as the right conditions are met. It can be called after

-
the trigger fires to rearm it again.

-
The "armed" condition survives enable/disable calls.

-
-

FailureMgr.Trigger._arm ( )

-
-

FailureMgr.Trigger.disarm ( )

-
Deactivate the trigger. The trigger will not fire until rearmed again.

-
-

FailureMgr.Trigger._disarm ( )

-
-

FailureMgr.Trigger.enable ( )

-
Enables/disables the trigger. While a trigger is disabled, any timer

-
or listener that could potentially own shall be disabled.

-
The FailureMgr calls these methods when the entire system is

-
enabled/disabled. By keeping enabled/disabled state separated from

-
armed/disarmed allows the FailureMgr to keep its configuration while

-
disabled, i.e. those triggers that where armed when the system was

-
disabled will resume when the system is enabled again.

-
The FailureMgr disables itself during a teleport.

-
-

FailureMgr.Trigger.disable ( )

-
-

FailureMgr.Trigger.bind ( path )

-
Creates an interface for the trigger in the property tree.

-
Every parameter in the params hash will be exposed, in addition to

-
a path/reset property for resetting the trigger from the prop tree.

-
-

FailureMgr.Trigger.unbind ( )

-
Removes this trigger's interface from the property tree.

-
-

FailureMgr.FailureActuator

-
FailureActuators encapsulate the actions required for activating the actual

-
failure simulation.

-
Traditionally this action was just manipulating a "serviceable" property

-
somewhere, but the FailureActuator gives you more flexibility, allowing you

-
to touch several properties at once or call other Nasal scripts, for example.

-
See Aircraft/Generic/Systems/failure.nas and

-
Aircraft/Generic/Systems/compat_failures.nas for some examples of actuators.

-
-

FailureMgr.FailureActuator.set_failure_level ( level )

-
Called from the failure manager to activate a certain level of failure.

-
level: Target level of failure [0 to 1].

-
-

FailureMgr.FailureActuator.get_failure_level ( 0, - )

-
Returns the level of failure that is currently being simulated.

-
-
-

canvas

-

canvas._getColor ( color )

-
Internal helper

-
-

canvas._arg2valarray ( )

-
-

canvas.Transform

-
Transform

-
A transformation matrix which is used to transform an Element on the canvas.

-
The dimensions of the matrix are 3x3 where the last row is always 0 0 1:

-
a c e

-
b d f

-
0 0 1

-
See http://www.w3.org/TR/SVG/coords.htmlTransformMatrixDefined for details.

-
-

canvas.Transform.new ( node, vals = nil )

-
-

canvas.Transform.setTranslation ( )

-
-

canvas.Transform.setRotation ( angle )

-
Set rotation (Optionally around a specified point instead of (0,0))

-
setRotation(rot)

-
setRotation(rot, cx, cy)

-
@note If using with rotation center different to (0,0) don't use

-
setTranslation as it would interfere with the rotation.

-
-

canvas.Transform.setScale ( )

-
Set scale (either as parameters or array)

-
If only one parameter is given its value is used for both x and y

-
setScale(x, y)

-
setScale([x, y])

-
-

canvas.Transform.getScale ( )

-
-

canvas.Element

-
Element

-
Baseclass for all elements on a canvas

-
-

canvas.Element.new ( ghost )

-
Constructor

-
@param ghost Element ghost as retrieved from core methods

-
-

canvas.Element.getParent ( )

-
Get parent group/element

-
-

canvas.Element.getCanvas ( )

-
Get the canvas this element is placed on

-
-

canvas.Element.equals ( el )

-
Check if elements represent same instance

-
@param el Other Element or element ghost

-
-

canvas.Element.setVisible ( visible = 1 )

-
Hide/Show element

-
@param visible Whether the element should be visible

-
-

canvas.Element.getVisible ( me.getBool )

-
-

canvas.Element.hide ( me.setVisible )

-
Hide element (Shortcut for setVisible(0))

-
-

canvas.Element.show ( me.setVisible )

-
Show element (Shortcut for setVisible(1))

-
-

canvas.Element.toggleVisibility ( me.setVisible )

-
Toggle element visibility

-
-

canvas.Element.setGeoPosition ( lat, lon )

-
-

canvas.Element.createTransform ( vals = nil )

-
Create a new transformation matrix

-
@param vals Default values (Vector of 6 elements)

-
-

canvas.Element.setTranslation ( )

-
Shortcut for setting translation

-
-

canvas.Element.getTranslation ( )

-
Get translation set with setTranslation

-
-

canvas.Element.setRotation ( rot )

-
Set rotation around transformation center (see setCenter).

-
@note This replaces the the existing transformation. For additional scale or

-
translation use additional transforms (see createTransform).

-
-

canvas.Element.setScale ( )

-
Shortcut for setting scale

-
-

canvas.Element.getScale ( me._getTf )

-
Shortcut for getting scale

-
-

canvas.Element.setColorFill ( me.set )

-
Set the fill/background/boundingbox color

-
@param color Vector of 3 or 4 values in [0, 1]

-
-

canvas.Element.getColorFill ( me.get )

-
-

canvas.Element.getTransformedBounds ( me.getTightBoundingBox )

-
-

canvas.Element.updateCenter ( )

-
Calculate the transformation center based on bounding box and center-offset

-
-

canvas.Element.setCenter ( )

-
Set transformation center (currently only used for rotation)

-
-

canvas.Element.getCenter ( )

-
Get transformation center

-
-

canvas.Element.boundingbox2clip ( bb )

-
convert bounding box vector into clip string (yes, different order)

-
-

canvas.Element.setClipByBoundingBox ( bounding_box, clip_frame = nil )

-
set clip by bounding box

-
bounding_box: [xmin, ymin, xmax, ymax]

-
-

canvas.Element.setClipByElement ( clip_elem )

-
set clipping by bounding box of another element

-
-

canvas.Element._getTf ( )

-
Internal Transform for convenience transform functions

-
-

canvas.Element._setupCenterNodes ( cx = nil, cy = nil )

-
-

canvas.Group

-
Group

-
Class for a group element on a canvas

-
-

canvas.Group.new ( ghost )

-
public:

-
-

canvas.Group.createChild ( type, id = nil )

-
Create a child of given type with specified id.

-
type can be group, text

-
-

canvas.Group.createChildren ( type, count )

-
Create multiple children of given type

-
-

canvas.Group.rect ( x, y, w, h, cfg = nil )

-
Create a path child drawing a (rounded) rectangle

-
@param x Position of left border

-
@param y Position of top border

-
@param w Width

-
@param h Height

-
@param cfg Optional settings (eg. {"border-top-radius": 5})

-
-

canvas.Group.getChildren ( )

-
Get a vector of all child elements

-
-

canvas.Group.getChildrenOfType ( type, array = nil )

-
Recursively get all children of class specified by first param

-
-

canvas.Group.setColor ( )

-
Set color to children of type Path and Text. It is possible to optionally

-
specify which types of children should be affected by passing a vector as

-
the last agrument, ie. my_group.setColor(1,1,1,[Path]);

-
-

canvas.Group.getElementById ( id )

-
Get first child with given id (breadth-first search)

-
@note Use with care as it can take several miliseconds (for me eg. ~2ms).

-
TODO check with new C++ implementation

-
-

canvas.Group.removeAllChildren ( )

-
Remove all children

-
-

canvas.Group._isElementNode ( el )

-
private:

-
-

canvas.Group._wrapElement ( node )

-
-

canvas.Group._getFactory ( type )

-
-

canvas.Map

-
Map

-
Class for a group element on a canvas with possibly geographic positions

-
which automatically get projected according to the specified projection.

-
Each map consists of an arbitrary number of layers (canvas groups)

-
-

canvas.Map.new ( ghost )

-
-

canvas.Map.del ( )

-
-

canvas.Map.setController ( controller=nil, arg... )

-
-

canvas.Map.getController ( )

-
-

canvas.Map.addLayer ( factory, type_arg=nil, priority=nil, style=nil, opts=nil, visible=1 )

-
-

canvas.Map.getLayer ( type_arg )

-
-

canvas.Map.setRange ( range )

-
-

canvas.Map.setScreenRange ( range )

-
-

canvas.Map.setPos ( lat, lon, hdg=nil, range=nil, alt=nil )

-
-

canvas.Map.getPos ( )

-
-

canvas.Map.getLat ( me.get )

-
-

canvas.Map.getLon ( me.get )

-
-

canvas.Map.getHdg ( me.get )

-
-

canvas.Map.getAlt ( me.get )

-
-

canvas.Map.getRange ( me.get )

-
-

canvas.Map.getScreenRange ( me.get )

-
-

canvas.Map.getLatLon ( )

-
-

canvas.Map.getPosCoord ( )

-
N.B.: This always returns the same geo.Coord object,

-
so its values can and will change at any time (call

-
update() on the coord to ensure it is up-to-date,

-
which basically calls this method again).

-
-

canvas.Map.update ( predicate=nil )

-
Update each layer on this Map. Called by

-
me.controller.

-
-

canvas.Text

-
Text

-
Class for a text element on a canvas

-
-

canvas.Text.new ( ghost )

-
-

canvas.Text.setText ( text )

-
Set the text

-
-

canvas.Text.getText ( )

-
-

canvas.Text.enableUpdate ( )

-
enable reduced property I/O update function

-
-

canvas.Text.updateText ( text )

-
reduced property I/O text update template

-
-

canvas.Text.enableFast ( )

-
enable fast setprop-based text writing

-
-

canvas.Text.setTextFast ( text )

-
fast, setprop-based text writing template

-
-

canvas.Text.appendText ( text )

-
append text to an existing string

-
-

canvas.Text.setAlignment ( align )

-
Set alignment

-
@param align String, one of:

-
left-top

-
left-center

-
left-bottom

-
center-top

-
center-center

-
center-bottom

-
right-top

-
right-center

-
right-bottom

-
left-baseline

-
center-baseline

-
right-baseline

-
left-bottom-baseline

-
center-bottom-baseline

-
right-bottom-baseline

-
-

canvas.Text.setFontSize ( size, aspect = 1 )

-
Set the font size

-
-

canvas.Text.setFont ( name )

-
Set font (by name of font file)

-
-

canvas.Text.setDrawMode ( mode )

-
Set draw mode. Binary combination of the values above. Since I haven't found

-
a bitwise or we have to use a + instead.

-
eg. my_text.setDrawMode(Text.TEXT + Text.BOUNDINGBOX);

-
-

canvas.Text.setPadding ( pad )

-
Set bounding box padding

-
-

canvas.Text.setMaxWidth ( w )

-
-

canvas.Text.setColor ( me.set )

-
-

canvas.Text.getColor ( me.get )

-
-

canvas.Text.setColorFill ( me.set )

-
-

canvas.Text.getColorFill ( me.get )

-
-

canvas.Path

-
Path

-
Class for an (OpenVG) path element on a canvas

-
-

canvas.Path.new ( ghost )

-
-

canvas.Path.reset ( )

-
Remove all existing path data

-
-

canvas.Path.setData ( cmds, coords )

-
Set the path data (commands and coordinates)

-
-

canvas.Path.setDataGeo ( cmds, coords )

-
-

canvas.Path.addSegment ( cmd, coords... )

-
Add a path segment

-
-

canvas.Path.addSegmentGeo ( cmd, coords... )

-
-

canvas.Path.pop_front ( me._removeSegment )

-
Remove first segment

-
-

canvas.Path.pop_back ( me._removeSegment )

-
Remove last segment

-
-

canvas.Path.getNumSegments ( )

-
Get the number of segments

-
-

canvas.Path.getNumCoords ( )

-
Get the number of coordinates (each command has 0..n coords)

-
-

canvas.Path.moveTo ( me.addSegment )

-
Move path cursor

-
-

canvas.Path.move ( me.addSegment )

-
-

canvas.Path.lineTo ( me.addSegment )

-
Add a line

-
-

canvas.Path.line ( me.addSegment )

-
-

canvas.Path.horizTo ( me.addSegment )

-
Add a horizontal line

-
-

canvas.Path.horiz ( me.addSegment )

-
-

canvas.Path.vertTo ( me.addSegment )

-
Add a vertical line

-
-

canvas.Path.vert ( me.addSegment )

-
-

canvas.Path.quadTo ( me.addSegment )

-
Add a quadratic Bézier curve

-
-

canvas.Path.quad ( me.addSegment )

-
-

canvas.Path.cubicTo ( me.addSegment )

-
Add a cubic Bézier curve

-
-

canvas.Path.cubic ( me.addSegment )

-
-

canvas.Path.squadTo ( me.addSegment )

-
Add a smooth quadratic Bézier curve

-
-

canvas.Path.squad ( me.addSegment )

-
-

canvas.Path.scubicTo ( me.addSegment )

-
Add a smooth cubic Bézier curve

-
-

canvas.Path.scubic ( me.addSegment )

-
-

canvas.Path.arcSmallCCWTo ( me.addSegment )

-
Draw an elliptical arc (shorter counter-clockwise arc)

-
-

canvas.Path.arcSmallCCW ( me.addSegment )

-
-

canvas.Path.arcSmallCWTo ( me.addSegment )

-
Draw an elliptical arc (shorter clockwise arc)

-
-

canvas.Path.arcSmallCW ( me.addSegment )

-
-

canvas.Path.arcLargeCCWTo ( me.addSegment )

-
Draw an elliptical arc (longer counter-clockwise arc)

-
-

canvas.Path.arcLargeCCW ( me.addSegment )

-
-

canvas.Path.arcLargeCWTo ( me.addSegment )

-
Draw an elliptical arc (shorter clockwise arc)

-
-

canvas.Path.arcLargeCW ( me.addSegment )

-
-

canvas.Path.close ( me.addSegment )

-
Close the path (implicit lineTo to first point of path)

-
-

canvas.Path.rect ( x, y, w, h, cfg = nil )

-
Add a (rounded) rectangle to the path

-
@param x Position of left border

-
@param y Position of top border

-
@param w Width

-
@param h Height

-
@param cfg Optional settings (eg. {"border-top-radius": 5})

-
-

canvas.Path.square ( x, y, l, cfg = nil )

-
Add a (rounded) square to the path

-
@param x Position of left border

-
@param y Position of top border

-
@param l length

-
@param cfg Optional settings (eg. {"border-top-radius": 5})

-
-

canvas.Path.ellipse ( rx, ry, cx = nil, cy = nil )

-
Add an ellipse to the path

-
@param rx radius x

-
@param ry radius y

-
@param cx (optional) center x coordinate or vector [cx, cy]

-
@param cy (optional) center y coordinate

-
-

canvas.Path.circle ( r, cx = nil, cy = nil )

-
Add a circle to the path

-
@param r radius

-
@param cx (optional) center x coordinate or vector [cx, cy]

-
@param cy (optional) center y coordinate

-
-

canvas.Path.setColor ( me.setStroke )

-
-

canvas.Path.getColor ( me.getStroke )

-
-

canvas.Path.setColorFill ( me.setFill )

-
-

canvas.Path.getColorFill ( me.getColorFill )

-
-

canvas.Path.setFill ( fill )

-
-

canvas.Path.setStroke ( stroke )

-
-

canvas.Path.getStroke ( me.get )

-
-

canvas.Path.setStrokeLineWidth ( width )

-
-

canvas.Path.setStrokeLineCap ( linecap )

-
Set stroke linecap

-
@param linecap String, "butt", "round" or "square"

-
See http://www.w3.org/TR/SVG/painting.htmlStrokeLinecapProperty for details

-
-

canvas.Path.setStrokeLineJoin ( linejoin )

-
Set stroke linejoin

-
@param linejoin String, "miter", "round" or "bevel"

-
See http://www.w3.org/TR/SVG/painting.htmlStrokeLinejoinProperty for details

-
-

canvas.Path.setStrokeDashArray ( pattern )

-
Set stroke dasharray

-
Set stroke dasharray

-
@param pattern Vector, Vector of alternating dash and gap lengths

-
[on1, off1, on2, ...]

-
-

canvas.Path._removeSegment ( front )

-
private:

-
-

canvas.Image

-
Image

-
Class for an image element on a canvas

-
-

canvas.Image.new ( ghost )

-
-

canvas.Image.setFile ( file )

-
Set image file to be used

-
@param file Path to file or canvas (Use canvas://... for canvas, eg.

-
canvas://by-index/texture[0])

-
-

canvas.Image.setSourceRect ( )

-
Set rectangular region of source image to be used

-
@param left Rectangle minimum x coordinate

-
@param top Rectangle minimum y coordinate

-
@param right Rectangle maximum x coordinate

-
@param bottom Rectangle maximum y coordinate

-
@param normalized Whether to use normalized ([0,1]) or image

-
([0, image_width]/[0, image_height]) coordinates

-
-

canvas.Image.setSize ( )

-
Set size of image element

-
@param width

-
@param height

-
- or -

-
@param size ([width, height])

-
-

canvas.Canvas

-
Canvas

-
Class for a canvas

-
-

canvas.Canvas.addPlacement ( vals )

-
Place this canvas somewhere onto the object. Pass criterions for placement

-
as a hash, eg:

-
my_canvas.addPlacement({

-
"texture": "EICAS.png",

-
"node": "PFD-Screen",

-
"parent": "Some parent name"

-
});

-
Note that we can choose whichever of the three filter criterions we use for

-
matching the target object for our placement. If none of the three fields is

-
given every texture of the model will be replaced.

-
-

canvas.Canvas.createGroup ( id = nil )

-
Create a new group with the given name

-
@param id Optional id/name for the group

-
-

canvas.Canvas.getGroup ( id )

-
Get the group with the given name

-
-

canvas.Canvas.setColorBackground ( me.set )

-
Set the background color

-
@param color Vector of 3 or 4 values in [0, 1]

-
-

canvas.Canvas.getColorBackground ( me.get )

-
-

canvas.Canvas.getPath ( )

-
Get path of canvas to be used eg. in Image::setFile

-
-

canvas.Canvas.del ( )

-
Destructor

-
releases associated canvas and makes this object unusable

-
-

canvas.wrapCanvas ( g )

-
@param g Canvas ghost

-
-

canvas.new ( vals )

-
Create a new canvas. Pass parameters as hash, eg:

-
var my_canvas = canvas.new({

-
"name": "PFD-Test",

-
"size": [512, 512],

-
"view": [768, 1024],

-
"mipmapping": 1

-
});

-
-

canvas.get ( arg )

-
Get the first existing canvas with the given name

-
@param name Name of the canvas

-
@return Canvas, if canvas with name exists

-
nil, otherwise

-
-

canvas.getDesktop ( )

-
-

canvas.gui

-
FlightGear canvas gui

-
Namespace: canvas

-
Classes:

-
WindowButton

-
Window

-
see also api.nas

-
-

canvas.loadGUIFile ( file )

-
-

canvas.loadWidget ( name )

-
-

canvas.loadDialog ( name )

-
-

canvas.WindowButton

-
-

canvas.WindowButton.new ( parent, name )

-
-

canvas.WindowButton._onStateChange ( )

-
protected:

-
-

canvas.Window

-
-

canvas.Window.new ( size, type = nil, id = nil )

-
Constructor

-
@param size ([width, height])

-
-

canvas.Window.del ( )

-
Destructor

-
-

canvas.Window.setTitle ( title )

-
-

canvas.Window.createCanvas ( )

-
Create the canvas to be used for this Window

-
@return The new canvas

-
-

canvas.Window.setCanvas ( canvas_ )

-
Set an existing canvas to be used for this Window

-
-

canvas.Window.getCanvas ( create = 0 )

-
Get the displayed canvas

-
-

canvas.Window.getCanvasDecoration ( )

-
-

canvas.Window.setLayout ( l )

-
-

canvas.Window.setFocus ( )

-
-

canvas.Window.clearFocus ( )

-
-

canvas.Window.setPosition ( )

-
-

canvas.Window.setSize ( )

-
-

canvas.Window.getSize ( )

-
-

canvas.Window.move ( )

-
-

canvas.Window.raise ( )

-
Raise to top of window stack

-
-

canvas.Window.onResize ( )

-
-

canvas.Window._onStateChange ( )

-
protected:

-
-

canvas.Window._propCallback ( child, mode )

-
private:

-
-

canvas.Window._handlePositionAbsolute ( child, mode, name, index )

-
-

canvas.Window._updatePos ( index, name )

-
-

canvas.Window._handleResize ( child, name )

-
-

canvas.Window._updateDecoration ( )

-
-

canvas.Window._resizeDecoration ( )

-
-

canvas.Dialog

-
Provide old 'Dialog' for backwards compatiblity (should be removed for 3.0)

-
-

canvas.Dialog.new ( size, type = nil, id = nil )

-
-

canvas.register_callback ( c )

-
-

canvas.run_callbacks ( foreach )

-
-

canvas.assert ( label, expr )

-
-

canvas.SURFACECOLORS

-
Mapping from surface codes to colors (shared by runways.draw and taxiways.draw)

-
-

canvas.draw_layer ( layer, callback, lod )

-
ALL LayeredMap "draws" go through this wrapper, which makes it easy to check what's going on:

-
-

canvas.Runway

-
Runway

-
-

canvas.Runway.new ( rwy )

-
Create Runway from hash

-
@param rwy Hash containing runway data as returned from

-
airportinfo().runways[ <runway designator> ]

-
-

canvas.Runway.pointOffCenterline ( pos, off = 0 )

-
Get a point on the runway with the given offset

-
@param pos Position along the center line

-
@param off Offset perpendicular to the center line

-
-

canvas.make ( return )

-
-

canvas.LayerModel.new ( make )

-
-

canvas.LayerModel.clear ( me._elements = )

-
-

canvas.LayerModel.push ( e )

-
-

canvas.LayerModel.get ( me._elements )

-
-

canvas.LayerModel.update ( )

-
-

canvas.LayerModel.hasData ( size )

-
-

canvas.LayerModel.setView ( v )

-
-

canvas.LayerModel.setController ( c )

-
-

canvas.Layer

-
A layer is mapped to a canvas group

-
Layers are linked to a single boolean property to toggle them on/off

-
FIXME: this is GUI specific ATM

-
-

canvas.Layer.new ( group, name, model, controller=nil )

-
-

canvas.Layer.hide ( me._view.setVisible )

-
-

canvas.Layer.show ( me._view.setVisible )

-
-

canvas.Layer.toggle ( )

-
TODO: Unify toggle and update methods - and support lazy drawing (make it optional!)

-
-

canvas.Layer.reset ( )

-
-

canvas.Layer.update ( )

-
TODO: Unify toggle and update FIXME: GUI specific, not needed for 744 ND.nas

-
-

canvas.Layer.setDraw ( callback )

-
-

canvas.Layer.setController ( c )

-
-

canvas.Layer.setModel ( m )

-
-

canvas.LayeredMap

-
A layered map consists of several layers

-
TODO: Support nested LayeredMaps, where a LayeredMap may contain other LayeredMaps

-
TODO: use MapBehavior here and move the zoom/refpos methods there, so that map behavior can be easily customized

-
-

canvas.LayeredMap.new ( parent, name )

-
-

canvas.LayeredMap.listen ( p,c )

-
-

canvas.LayeredMap.initializeLayers ( )

-
-

canvas.LayeredMap.setRefPos ( lat, lon )

-
-

canvas.LayeredMap.setHdg ( hdg )

-
-

canvas.LayeredMap.updateZoom ( )

-
-

canvas.LayeredMap.updateState ( )

-
this is a huge hack at the moment, we need to encapsulate the setRefPos/setHdg methods, so that they are exposed to XML space

-
-

canvas.LayeredMap.setupZoom ( dialog )

-
TODO: this is currently GUI specific and not re-usable for instruments

-
-

canvas.LayeredMap.setZoom ( )

-
-

canvas.LayeredMap.resetLayers ( )

-
-

canvas.LayeredMap.cleanup_listeners ( )

-
FIXME: listener management should be done at the MVC level, for each component - not as part of the LayeredMap!

-
-

canvas.GenericMap

-
GenericMap: A generic map is a layered map that puts all supported features on a different layer (canvas group) so that

-
they can be individually toggled on/off so that unnecessary updates are avoided, there are methods to link layers to boolean properties

-
so that they can be easily associated with GUI properties (checkboxes) or cockpit hotspots

-
TODO: generalize the XML-parametrization and move it to a helper class

-
-

canvas.GenericMap.new ( parent, name )

-
-

canvas.GenericMap.setupLayer ( layer, property )

-
-

canvas.GenericMap.setupFeature ( layer, property, init )

-
features are layers - so this will do layer setup and then register listeners for each layer

-
-

canvas.GenericMap.pickupFeatures ( DIALOG_CANVAS )

-
This will read in the config and procedurally instantiate all requested layers and link them to toggle properties

-
FIXME: this is currently GUI specific and doesn't yet support instrument use, i.e. needs to be generalized further

-
-

canvas.GenericMap.setupGUI ( dialog, group )

-
NOT a method, cmdarg() is no longer meaningful when the canvas nasal block is executed

-
so this needs to be called in the dialog's OPEN block instead - TODO: generalize

-
FIXME: move somewhere else, this really is a GUI helper and should probably be generalized and moved to gui.nas

-
-

canvas.LayerModel.notifyView ( )

-
this is currently "directly" invoked via a listener, needs to be changed

-
to use the controller object instead

-
TODO: adopt real MVC here

-
FIXME: this must currently be explicitly called by the model, we need to use a wrapper to call it automatically instead!

-
-

canvas.MAP_LAYERS

-
TODO: a "MapLayer" is a full MVC implementation that is owned by a "LayeredMap"

-
-

canvas.register_layer ( name, layer )

-
-

canvas.load_modules ( vec, ns= )

-
-

canvas.files_with ( ext )

-
read in the file names dynamically: *.draw, *.model, *.layer

-
-

canvas.RouteDriver

-
-

canvas.RouteDriver.new ( )

-
-

canvas.RouteDriver.init ( )

-
-

canvas.RouteDriver.update ( )

-
-

canvas.RouteDriver.getNumberOfFlightPlans ( )

-
-

canvas.RouteDriver.getFlightPlanType ( fpNum )

-
-

canvas.RouteDriver.getFlightPlan ( fpNum )

-
-

canvas.RouteDriver.getPlanSize ( fpNum )

-
-

canvas.RouteDriver.getWP ( fpNum, idx )

-
-

canvas.RouteDriver.getPlanModeWP ( plan_wp_idx )

-
-

canvas.RouteDriver.hasDiscontinuity ( fpNum, wptID )

-
-

canvas.RouteDriver.getListeners ( )

-
-

canvas.RouteDriver.shouldUpdate ( 1 - )

-
-

canvas.MultiRouteDriver

-
-

canvas.MultiRouteDriver.new ( )

-
-

canvas.MultiRouteDriver.addFlightPlan ( type, plan )

-
-

canvas.MultiRouteDriver.removeFlightPlanAtIndex ( idx )

-
-

canvas.MultiRouteDriver.removeFlightPlanOfType ( type )

-
-

canvas.MultiRouteDriver.getNumberOfFlightPlans ( )

-
-

canvas.MultiRouteDriver.getFlightPlanType ( fpNum )

-
-

canvas.MultiRouteDriver.getFlightPlan ( fpNum )

-
-

canvas.MultiRouteDriver.getPlanSize ( fpNum )

-
-

canvas.MultiRouteDriver.getWP ( fpNum, idx )

-
-

canvas.MultiRouteDriver.getPlanModeWP ( idx )

-
-

canvas.MultiRouteDriver.triggerSignal ( signal )

-
-

canvas.MultiRouteDriver.signalPath ( signal )

-
-

canvas.MultiRouteDriver.getListeners ( )

-
-

canvas.makedie ( prefix )

-
var _MP_dbg_lvl = "alert";

-
-

canvas.try_aux_method ( obj, method_name )

-
Try to call a method on an object with no arguments. Should

-
work for both ghosts and hashes; catches the error only when

-
the method doesn't exist -- errors raised during the call

-
are re-thrown.

-
-

canvas.default_hash ( opt, df )

-
Combine a specific hash with a default hash, e.g. for

-
options/df_options and style/df_style in a SymbolLayer.

-
-

canvas.MapStructure_selfTest ( )

-
to be used for prototyping, performance & stress testing (especially with multiple instance driven by AI traffic)

-
-

canvas.CachedElement

-
wrapper for each cached element: keeps the canvas and

-
texture map coordinates for the corresponding raster image.

-
-

canvas.CachedElement.new ( canvas_path, name, source, size, offset )

-
-

canvas.CachedElement.render ( group, trans0=0, trans1=0 )

-
-

canvas.SymbolCache

-
-

canvas.SymbolCache.new ( dim... )

-
-

canvas.SymbolCache.add ( name, callback, draw_mode=0 )

-
Add a cached symbol based on a drawing callback.

-
@note this assumes that the object added by callback

-
fits into the dimensions provided to the constructor,

-
and any larger dimensionalities are liable to be cut off.

-
-

canvas.SymbolCache.get ( name )

-
-

canvas.issym ( string )

-
-

canvas.internsymbol ( symbol )

-
-

canvas.tryintern ( symbol )

-
-

canvas.unescape ( s )

-
End excerpt

-
Helpers for below

-
-

canvas.hashdup ( _,rkeys=nil )

-
-

canvas.opt_member ( h,k )

-
-

canvas.member ( h,k )

-
-

canvas._in ( vec,k )

-
-

canvas.members ( h,vec=nil )

-
-

canvas.serialize ( m,others=nil )

-
-

canvas.call_draw ( draw, style, arg=nil, relevant_keys=nil )

-
Drawing functions have the form:

-
func(group) { group.createChild(...).set<Option>(<option>); ... }

-
The style is passed as (essentially) their local namespace/variables,

-
while the group is a regular argument.

-
-

canvas.style_string ( style, relevant_keys=nil )

-
Serialize a style into a string.

-
-

canvas.StyleableCacheable

-
A class to mix styling and caching. Using the above helpers it

-
serializes style hashes.

-
-

canvas.StyleableCacheable.new ( name, draw_func, cache, draw_mode=0, relevant_keys=nil )

-
Construct an object.

-
@param name Prefix to use for entries in the cache

-
@param draw_func Function for the cache that will draw the

-
symbol onto a group using the style parameters.

-
@param cache The SymbolCache to use for these symbols.

-
@param draw_mode See SymbolCache

-
@param relevant_keys A list of keys for the style used by the

-
draw_func. Although it defaults to all

-
available keys, it is highly recommended

-
that it be specified.

-
-

canvas.StyleableCacheable.request ( style )

-
Note: configuration like active/inactive needs

-
to also use the passed style hash, unless it is

-
chosen not to cache symbols that are, e.g., active.

-
-

canvas.StyleableCacheable.render ( element, style )

-
-

canvas.StyleableCacheable.draw ( style,s1 )

-
-

canvas.Symbol

-
A base class for Symbols placed on a map.

-
Note: for the derived objects, the element is stored as obj.element.

-
This is also part of the object's parents vector, which allows

-
callers to use obj.setVisible() et al. However, for code that

-
manipulates the element's path (if it is a Canvas Path), it is best

-
to use obj.element.addSegmentGeo() et al. for consistency.

-
-

canvas.Symbol.add ( type, class )

-
-

canvas.Symbol.get ( type )

-
-

canvas.Symbol.new ( type, group, layer, arg... )

-
Calls corresonding symbol constructor

-
@param group Canvas.Group to place this on.

-
@param layer The SymbolLayer this is a child of.

-
-

canvas.Symbol._new ( m )

-
Private constructor:

-
-

canvas.Symbol.update ( )

-
Update the drawing of this object (position and others).

-
-

canvas.Symbol.draw ( )

-
-

canvas.Symbol.del ( )

-
-

canvas.Symbol.newText ( text=nil, color=nil )

-
Add a text element with styling

-
-

canvas.Symbol.formattedString ( frmt, model_props )

-
Helper method that can be used to create a formatted String using

-
values extracted from the current model.

-
SYNOPSIS:

-
symbol.formattedString(format, model_property_names)

-
Arguments:

-
- format: string

-
- model_property_names: a vector of strings representing the model

-
property names to be used as arguments

-
EXAMPLE:

-
var label = waypoint.formattedString('Waypoint %s: lat %.4f, lng %.4f', [model.id, model.lat, model.lon]);

-
-

canvas.Symbol.getOption ( name, default = nil )

-
Wrapper method for accessing options. It allows to pass a default value

-
if the requested option is not defined.

-
EXAMPLE:

-
var ok = (contains(me.options, 'enabled') ? me.options.enabled : 0);

-
var ok = me.getOption('enabled', 0);

-
-

canvas.Symbol.getStyle ( name, default = nil )

-
Wrapper method for accessing style. It allows to pass a default value

-
if the requested style is not defined.

-
It also automatically resolves style properties when they're defined as

-
functions, by calling the corresponding function using the 'me' context

-
EXAMPLE:

-
me.style = {

-
color: [1,1,1],

-
line_color: func(){

-
me.model.tuned ? [0,0,1] : [1,1,1]

-
}

-
}

-
var color = me.getStyle('color'); --> [1,1,1]

-
me.model.tuned = 1;

-
var line_color = me.getStyle('line_color'); --> [0,0,1]

-
var txt_color = me.getStyle('text_color', [1,1,1]); --> [1,1,1]

-
-

canvas.Symbol.getLabelFromModel ( default_val = nil )

-
-

canvas.Symbol.callback ( name, args... )

-
Executes callback function specified by the first argument with

-
variable arguments. The callback is executed within the 'me' context.

-
Callbacks must be defined inside the options hash.

-
EXAMPLE:

-
me.options = {

-
dump_callback: func(){

-
print('Waypoint '~ me.model.id);

-
}

-
}

-
me.callback('dump');

-
-

canvas.Symbol.add ( type, class )

-
-

canvas.Symbol.get ( type )

-
-

canvas.Symbol.new ( type, symbol, model, arg... )

-
Calls corresonding symbol controller constructor

-
@param model Model to control this object (position and other attributes).

-
-

canvas.Symbol.update ( symbol, model )

-
Non-static:

-
Update anything related to a particular model. Returns whether the object needs updating:

-
-

canvas.Symbol.del ( symbol, model )

-
Delete an object from this controller (or delete the controller itself):

-
-

canvas.Symbol.isVisible ( model )

-
Return whether this model/symbol is (should be) visible:

-
-

canvas.Symbol.getpos ( model )

-
Get the position of this symbol/object:

-
-

canvas.getpos_fromghost ( positioned_g )

-
-

canvas.is_positioned_ghost ( obj )

-
-

canvas.register_supported_ghost ( name )

-
-

canvas.assert_m ( hash, member )

-
-

canvas.assert_ms ( hash, members... )

-
-

canvas.DotSym

-
Implementation for a particular type of symbol (for the *.symbol files)

-
to handle details.

-
-

canvas.DotSym.makeinstance ( name, hash )

-
Static/singleton:

-
-

canvas.DotSym.new ( group, layer, model, controller=nil )

-
For the instances returned from makeinstance:

-
@param group The Canvas.Group to add this to.

-
@param layer The SymbolLayer this is a child of.

-
@param model A correct object (e.g. positioned ghost) as

-
expected by the .draw file that represents

-
metadata like position, speed, etc.

-
@param controller Optional controller "glue". Each method

-
is called with the model as the only argument.

-
-

canvas.DotSym.del ( )

-
-

canvas.DotSym.init ( )

-
Default wrappers:

-
-

canvas.DotSym.deinit ( )

-
-

canvas.DotSym.update ( )

-
-

canvas.SVGSymbol

-
Small wrapper for DotSym: parse a SVG on init().

-
-

canvas.SVGSymbol.init ( )

-
-

canvas.SVGSymbol.draw ( )

-
-

canvas.RasterSymbol

-
wrapper for symbols based on raster images (i.e. PNGs)

-
TODO: generalize this and port WXR.symbol accordingly

-
-

canvas.RasterSymbol.init ( )

-
-

canvas.RasterSymbol.draw ( , - )

-
-

canvas.LineSymbol

-
-

canvas.LineSymbol.makeinstance ( name, hash )

-
Static/singleton:

-
-

canvas.LineSymbol.new ( group, layer, model, controller=nil )

-
For the instances returned from makeinstance:

-
-

canvas.LineSymbol.draw ( )

-
Non-static:

-
-

canvas.LineSymbol.del ( )

-
-

canvas.LineSymbol.init ( )

-
Default wrappers:

-
-

canvas.LineSymbol.deinit ( )

-
-

canvas.LineSymbol.update ( )

-
-

canvas.SymbolLayer

-
Base class for a SymbolLayer, e.g. MultiSymbolLayer or SingleSymbolLayer.

-
-

canvas.SymbolLayer.add ( type, class )

-
-

canvas.SymbolLayer.get ( type )

-
-

canvas.SymbolLayer.new ( type, group, map, controller=nil, style=nil, options=nil, visible=1, arg... )

-
Calls corresonding layer constructor

-
@param group Canvas.Group to place this on.

-
@param map The Canvas.Map this is a member of.

-
@param controller A controller object.

-
@param style An alternate style.

-
@param options Extra options/configurations.

-
@param visible Initially set it up as visible or invisible.

-
-

canvas.SymbolLayer._new ( m, style, controller, options )

-
Private constructor:

-
-

canvas.SymbolLayer.del ( )

-
For instances:

-
-

canvas.SymbolLayer.update ( )

-
-

canvas.SymbolLayer.add ( type, class )

-
-

canvas.SymbolLayer.get ( type )

-
-

canvas.SymbolLayer.new ( type, layer, arg... )

-
Calls corresonding controller constructor

-
@param layer The SymbolLayer this controller is responsible for.

-
-

canvas.SymbolLayer.searchCmd ( )

-
Default implementations for derived classes:

-
@return List of positioned objects.

-
-

canvas.SymbolLayer.addVisibilityListener ( )

-
-

canvas.SymbolLayer.getModel ( me._model, )

-
Default implementations for derived objects:

-
For SingleSymbolLayer: retreive the model object

-
-

canvas.MultiSymbolLayer

-
A layer that manages a list of symbols (using delta positioned handling

-
with a searchCmd to retreive placements).

-
-

canvas.MultiSymbolLayer.new ( group, map, controller=nil, style=nil, options=nil, visible=1 )

-
Default implementations/values:

-
@param group A group to place this on.

-
@param map The Canvas.Map this is a member of.

-
@param controller A controller object (parents=[SymbolLayer.Controller])

-
or implementation (parents[0].parents=[SymbolLayer.Controller]).

-
@param style An alternate style.

-
@param options Extra options/configurations.

-
@param visible Initially set it up as visible or invisible.

-
-

canvas.MultiSymbolLayer.update ( )

-
-

canvas.MultiSymbolLayer.del ( )

-
-

canvas.MultiSymbolLayer.delsym ( model )

-
-

canvas.MultiSymbolLayer.searchCmd ( )

-
-

canvas.MultiSymbolLayer.onAdded ( model )

-
Adds a symbol.

-
-

canvas.MultiSymbolLayer.onRemoved ( model )

-
Removes a symbol.

-
-

canvas.NavaidSymbolLayer

-
A layer that manages a list of statically-positioned navaid symbols (using delta positioned handling

-
with a searchCmd to retrieve placements).

-
This is not yet supposed to work properly, it's just there to help get rid of all the identical boilerplate code

-
in lcontroller files, so needs some reviewing and customizing still

-
-

canvas.NavaidSymbolLayer.make ( query )

-
static generator/functor maker:

-
-

canvas.SingleSymbolLayer

-
TODO: wrappers for Horizontal vs. Vertical layers ?

-
-

canvas.SingleSymbolLayer.new ( group, map, controller=nil, style=nil, options=nil, visible=1 )

-
Default implementations/values:

-
@param group A group to place this on.

-
@param map The Canvas.Map this is a member of.

-
@param controller A controller object (parents=[SymbolLayer.Controller])

-
or implementation (parents[0].parents=[SymbolLayer.Controller]).

-
@param style An alternate style.

-
@param options Extra options/configurations.

-
@param visible Initially set it up as visible or invisible.

-
-

canvas.SingleSymbolLayer.update ( )

-
-

canvas.SingleSymbolLayer.del ( )

-
-

canvas.OverlayLayer

-
Base class for a OverlayLayer, e.g. a TileLayer

-
-

canvas.OverlayLayer.add ( type, class )

-
-

canvas.OverlayLayer.get ( type )

-
-

canvas.OverlayLayer.new ( type, group, map, controller=nil, style=nil, options=nil, visible=1, arg... )

-
Calls corresonding layer constructor

-
@param group Canvas.Group to place this on.

-
@param map The Canvas.Map this is a member of.

-
@param style An alternate style.

-
@param options Extra options/configurations.

-
@param visible Initially set it up as visible or invisible.

-
-

canvas.OverlayLayer._new ( m, style, controller, options )

-
Private constructor:

-
-

canvas.OverlayLayer.del ( )

-
For instances:

-
-

canvas.OverlayLayer.update ( )

-
-

canvas.TileLayer

-
-

canvas.TileLayer.new ( group, map, controller=nil, style=nil, options=nil, visible=1 )

-
Default implementations/values:

-
@param group A group to place this on.

-
@param map The Canvas.Map this is a member of.

-
@param controller A controller object (parents=[OverlayLayer.Controller])

-
or implementation (parents[0].parents=[OverlayLayer.Controller]).

-
@param style An alternate style.

-
@param options Extra options/configurations.

-
@param visible Initially set it up as visible or invisible.

-
-

canvas.TileLayer.updateLayer ( )

-
-

canvas.TileLayer.update ( )

-
-

canvas.TileLayer.del ( )

-
-

canvas.TileLayer.add ( type, class )

-
-

canvas.TileLayer.get ( type )

-
-

canvas.TileLayer.new ( type, layer, arg... )

-
Calls corresponding controller constructor

-
@param layer The OverlayLayer this controller is responsible for.

-
-

canvas.TileLayer.updateLayer ( )

-
Default implementations for derived classes:

-
@return List of positioned objects.

-
-

canvas.TileLayer.addVisibilityListener ( )

-
-

canvas.TileLayer.addRangeListener ( )

-
-

canvas.TileLayer.addScreenRangeListener ( )

-
-

canvas.MapStructure

-
-

canvas.MapStructure.loadFile ( file, name )

-
Generalized load methods used to load various symbols, layer controllers,...

-
-

canvas.load_MapStructure ( )

-
-

canvas.MapStructure.add ( type, class )

-
-

canvas.MapStructure.get ( type )

-
-

canvas.MapStructure.new ( type, map, arg... )

-
Calls corresonding controller constructor

-
@param map The SymbolMap this controller is responsible for.

-
-

canvas.MapStructure.get_position ( )

-
Default implementations:

-
-

canvas.MapStructure.query_range ( )

-
-

canvas.MapStructure.in_range ( lat, lon, alt=0 )

-
-

canvas.PropertyElement

-
PropertyElement

-
Baseclass for all property controlled elements/objects

-
-

canvas.PropertyElement.new ( node, id )

-
Constructor

-
@param node Node to be used for element or vector [parent, type] for

-
creation of a new node with name type and given parent

-
@param id ID/Name (Should be unique)

-
-

canvas.PropertyElement.del ( )

-
Destructor (has to be called manually!)

-
-

canvas.PropertyElement.set ( key, value )

-
-

canvas.PropertyElement.setBool ( key, value )

-
-

canvas.PropertyElement.setDouble ( key, value )

-
-

canvas.PropertyElement.setInt ( key, value )

-
-

canvas.PropertyElement.get ( key, default = nil )

-
-

canvas.PropertyElement.getBool ( key )

-
-

canvas.PropertyElement.update ( )

-
Trigger an update of the element

-
Elements are automatically updated once a frame, with a delay of one frame.

-
If you wan't to get an element updated in the current frame you have to use

-
this method.

-
-

canvas.parsesvg ( group, path, options = nil )

-
Parse an xml file into a canvas group element

-
@param group The canvas.Group instance to append the parsed elements to

-
@param path The path of the svg file (absolute or relative to FG_ROOT)

-
@param options Optional hash of options

-
font-mapper func

-
parse_images bool

-
-

canvas.Tooltip

-
-

canvas.Tooltip.new ( size, id = nil )

-
Constructor

-
@param size ([width, height])

-
-

canvas.Tooltip.del ( )

-
Destructor

-
-

canvas.Tooltip.createCanvas ( )

-
Create the canvas to be used for this Tooltip

-
@return The new canvas

-
-

canvas.Tooltip.setLabel ( msg )

-
-

canvas.Tooltip.setProperty ( prop )

-
-

canvas.Tooltip.setWidthText ( txt )

-
specify a string used to compute the width of the tooltip

-
-

canvas.Tooltip._updateText ( )

-
-

canvas.Tooltip._updateBounds ( )

-
-

canvas.Tooltip._remapValue ( val )

-
-

canvas.Tooltip.setMapping ( mapping, f = nil )

-
-

canvas.Tooltip.setTooltipId ( tipId )

-
-

canvas.Tooltip.getTooltipId ( )

-
-

canvas.Tooltip.getCanvas ( )

-
Get the displayed canvas

-
-

canvas.Tooltip.setPosition ( x, y )

-
-

canvas.Tooltip.isMessage ( )

-
-

canvas.Tooltip.show ( )

-
-

canvas.Tooltip.showMessage ( timeout = nil, node = nil )

-
-

canvas.Tooltip._haveNode ( node, key )

-
-

canvas.Tooltip.hide ( )

-
-

canvas.Tooltip.hideNow ( )

-
-

canvas.Tooltip.isVisible ( )

-
-

canvas.Tooltip.fadeIn ( )

-
-

canvas.Tooltip.fadeOut ( )

-
-

canvas.Tooltip._hideTimeout ( )

-
private:

-
-

canvas.innerSetTooltip ( node )

-
-

canvas.setTooltip ( node )

-
-

canvas.showTooltip ( node )

-
-

canvas.updateHover ( node )

-
-

canvas.showMessage ( node )

-
-

canvas.clearMessage ( node )

-
-
-

console

-

console.REPL

-
var _REPL_dbg_level = "alert";

-
-

console.REPL.new ( placement, name= )

-
-

console.REPL.execute ( )

-
-

console.REPL._is_str_char ( char )

-
-

console.REPL._handle_level ( level, str, line_number )

-
-

console.REPL.get_input ( )

-
-

console.CanvasPlacement

-
-

console.CanvasPlacement.new ( name= )

-
-

console.CanvasPlacement.del ( )

-
-

console.CanvasPlacement.add_char ( char, reset_view=0 )

-
-

console.CanvasPlacement.add_text ( text, reset_view=0 )

-
-

console.CanvasPlacement.remove_char ( reset_view=0 )

-
-

console.CanvasPlacement.clear_input ( reset_view=0 )

-
-

console.CanvasPlacement.replace_line ( replacement, replace_input=1, reset_view=0 )

-
-

console.CanvasPlacement.add_line ( text, reset_text=1, reset_view=0 )

-
-

console.CanvasPlacement.new_prompt ( )

-
-

console.CanvasPlacement.continue_line ( reset_text=1 )

-
-

console.CanvasPlacement.reset_input_from_history ( reset_view=0 )

-
-

console.CanvasPlacement.reset_view ( )

-
-

console.CanvasPlacement.set_line_color ( color )

-
-

console.CanvasPlacement.set_line_font ( font )

-
-

console.CanvasPlacement.clear ( )

-
-

console.CanvasPlacement.create_msg ( )

-
-

console.CanvasPlacement.create_line ( reset_text=1 )

-
-

console.CanvasPlacement.update ( )

-
-

console.CanvasPlacement.handle_key ( key, modifiers, keyCode )

-
-

console.CanvasPlacement.get_line ( )

-
-

console.CanvasPlacement.display_result ( res=nil )

-
-

console.CanvasPlacement.handle_runtime_error ( err )

-
-

console.CanvasPlacement.handle_parse_error ( msg, file, line )

-
-

console.CanvasPlacement.gettranslation ( k )

-
-

console.print2 ( i )

-
-
-

input_helpers

-

input_helpers.formatFrequencyMHz ( freqMhz, fieldWidth )

-
-

input_helpers.formatFrequencyKHz ( freqKhz, fieldWidth )

-
-

input_helpers.bytesForString ( s, fieldWidth )

-
-

input_helpers.translateTo14Segment

-
TEST

-
STBY

-
OFF

-
XPDR

-
TA

-
TA/RA

-
-

input_helpers.formatFourteenSegment ( s, fieldWidth )

-
-

input_helpers.reverseBytes ( bytes )

-
-

input_helpers.MFRController

-
-

input_helpers.MFRController.new ( prefix )

-
-

input_helpers.mcp

-
-

input_helpers.mcp.init ( )

-
-

input_helpers.mcp.setAltitudeFtProp ( path )

-
-

input_helpers.mcp.doRefresh ( )

-
-

input_helpers.mcp.doRefreshHeading ( )

-
-

input_helpers.mcp.setMachMode ( useMach )

-
-

input_helpers.mcp.altitudeData ( )

-
-

input_helpers.mcp.vsData ( )

-
-

input_helpers.mcp.speedData ( )

-
-

input_helpers.mcp.adjustSpeed ( val )

-
-

input_helpers.mcp.adjustAltitude ( val )

-
-

input_helpers.mcp.headingData ( )

-
-

input_helpers.mcp.course1Data ( )

-
-

input_helpers.mcp.course2Data ( )

-
-

input_helpers.mcp.watchPropertyForLED ( prop, ledName )

-
-

input_helpers.mcp.setLED ( data, b )

-
-
-

jetways

-

jetways.print_debug ( msg )

-
toggle_jetway(<id>) - toggles a jetway by user command (should be called by a pick animation in a jetway model)

-
<id> - id number of jetway to toggle

-
toggle_jetway_from_coord(<door>, <hood>, - toggles a jetway with the target door at the specified coordinates

-
<heading>, [<lat>,

-
<lon>] [<coord>])

-
<door> - door number (i.e. 0)

-
<hood> - amount to rotate jetway hood

-
<lat> - (required or <coord>) latitude location of door

-
<lon> - (required or <coord>) longitude location of door

-
<coord> - (required or <lat>, <lon>) a geo.Coord of the door

-
toggle_jetway_from_model(<model node>) - toggles a jetway using an AI model instead of the user's aircraft

-
<model node> - path of AI model (i.e. /ai/models/aircraft[0])- can be the path in a string or a props.Node

-
INTERNAL FUNCTIONS

-
------------------

-
load_airport_jetways(<airport>) - loads jetways at an airport

-
<airport> - ICAO of airport

-
unload_airport_jetways(<airport>) - unloads jetways at an airport

-
<airport> - ICAO of airport

-
update_jetways() - interpolates model animation values

-
load_jetways() - loads new jetway models and unloads out-of-range models every 10 seconds; also connects AI and MP aircraft

-
Utility functions

-
prints debug messages

-
-

jetways.print_error ( msg )

-
prints error messages

-
-

jetways.alert ( msg )

-
alerts the user

-
-

jetways.normdeg ( x )

-
normalizes headings between -180 and 180

-
-

jetways.remove ( vector, item )

-
deletes an item in a vector

-
-

jetways.isin ( vector, v )

-
checks if an item is in a vector

-
-

jetways.putmodel ( path, lat, lon, alt, hdg )

-
adds a model

-
-

jetways.interpolate_table ( table, v )

-
interpolates a value

-
-

jetways.get_relative_filepath ( path, target )

-
gets a relative file path

-
-

jetways.find_airports ( max_distance )

-
gets a list of nearest airports

-
TODO: Don't use /sim/airport/nearest-airport-id, which restricts the list to 1 airport

-
-

jetways.loadids

-
-

jetways.loadids.new ( airport, model, gate, door, airline, lat, lon, alt, heading, init_extend = 0, init_heading = 0, init_pitch = 0, init_ent_heading = 0 )

-
-

jetways.loadids.toggle ( user, heading, coord, hood = 0 )

-
-

jetways.loadids.extend ( user, heading, door_coord, hood = 0 )

-
-

jetways.loadids.retract ( user )

-
-

jetways.loadids.remove ( )

-
-

jetways.loadids.reload ( )

-
-

jetways.loadids.setpos ( lat, lon, hdg, alt )

-
-

jetways.loadids.setmodel ( model, airline, gate )

-
-

jetways.dialog ( )

-
Interaction functions

-
-

jetways.toggle_jetway ( n )

-
-

jetways.toggle_jetway_from_coord ( door, hood, heading, lat, lon = nil )

-
-

jetways.toggle_jetway_from_model ( model )

-
-

jetways.load_airport_jetways ( airport )

-
Internal functions

-
loads jetways at an airport

-
-

jetways.unload_airport_jetways ( airport )

-
unloads jetways at an airport

-
-

jetways.restart ( )

-
restarts the main update loop

-
-

jetways.update_jetways ( loopid )

-
main update loop (runs when jetways are enable and actived)

-
-

jetways.load_jetways ( loopid )

-
loading/unloading loop (runs continuously)

-
-
-

jetways_edit

-

jetways_edit.click ( pos )

-
-

jetways_edit.delete ( )

-
-

jetways_edit.adjust ( name, value )

-
-

jetways_edit.export ( )

-
-

jetways_edit.convert_stg ( )

-
var report = func(n) { print("file ", n.getValue(), " selected") }

-
-

jetways_edit.convert_stg2 ( n )

-
-

jetways_edit.flash ( jetway )

-
-

jetways_edit.dialog ( )

-
-

jetways_edit.print_help ( )

-
-
-

local_weather

-

local_weather.select_cloud_model ( type, subtype )

-
function purpose

-
select_cloud_model to define the cloud parameters, given the cloud type and subtype

-
define various cloud models

-
-

local_weather.cloudAssembly

-
hash for assembling hard-coded clouds

-
-

local_weather.create_undulatus ( type, blat, blong, balt, alt_var, nx, xoffset, edgex, x_var, ny, yoffset, edgey, y_var, und_strength, direction, tri )

-
routines to set up, transform and manage advanced weather

-
Thorsten Renk, April 2012

-
function purpose

-
create_undulatus to create an undulating cloud pattern

-
create_cumulus_alleys to create an alley pattern of Cumulus clouds

-
create_layer to create a cloud layer with optional precipitation

-
place an undulatus pattern

-
-

local_weather.create_adv_undulatus ( arg )

-
place an advanced undulatus pattern

-
-

local_weather.sgn ( x )

-
place a stick bundle pattern

-
-

local_weather.create_stick_bundle ( arg )

-
-

local_weather.create_domains ( arg )

-
place a nested domains pattern

-
-

local_weather.create_cumulus_alleys ( blat, blon, balt, alt_var, nx, xoffset, edgex, x_var, ny, yoffset, edgey, y_var, und_strength, direction, tri )

-
place a Cumulus alley pattern

-
-

local_weather.create_developing_cumulus_alleys ( blat, blon, balt, alt_var, nx, xoffset, edgex, x_var, ny, yoffset, edgey, y_var, und_strength, direction, tri )

-
place a Cumulus alley pattern

-
-

local_weather.create_layer ( type, blat, blon, balt, bthick, rx, ry, phi, density, edge, rainflag, rain_density )

-
place a cloud layer

-
-

local_weather.cumulus_exclusion_layer ( blat, blon, balt, n, size_x, size_y, alpha, s_min, s_max, n_ex, exlat, exlon, exrad )

-
place a Cumulus layer with excluded regions

-
to avoid placing cumulus underneath a thunderstorm

-
-

local_weather.setDefaultCloudsOff ( )

-
-

local_weather.setVisibility ( vis )

-
set visibility to given value

-
-

local_weather.setVisibilitySmoothly ( vis )

-
-

local_weather.visibility_loop ( )

-
-

local_weather.setLift ( lift )

-
set thermal lift to given value

-
-

local_weather.setRain ( rain )

-
set rain properties

-
-

local_weather.setRainDropletSize ( size )

-
-

local_weather.setSnow ( snow )

-
set snow properties

-
-

local_weather.setSnowFlakeSize ( size )

-
-

local_weather.setTurbulence ( turbulence )

-
set turbulence to given value

-
-

local_weather.setTemperature ( T )

-
set temperature to given value

-
-

local_weather.setPressure ( p )

-
set pressure to given value

-
-

local_weather.setDewpoint ( D )

-
set dewpoint to given value

-
-

local_weather.setLight ( s )

-
set light saturation to given value

-
-

local_weather.setLightSmoothly ( s )

-
-

local_weather.light_loop ( )

-
-

local_weather.setScattering ( s )

-
set horizon scattering

-
-

local_weather.setOvercast ( o )

-
set overcast haze

-
-

local_weather.setSkydomeShader ( r, m, d )

-
set skydome scattering parameters

-
-

local_weather.setWind ( dir, speed )

-
set wind to given direction and speed

-
-

local_weather.smoothDirection ( dir0, dir1, factor )

-
set wind smoothly to given direction and speed

-
interpolating across several frames

-
-

local_weather.setWindSmoothly ( dir, speed )

-
-

local_weather.create_cloud ( path, lat, long, alt, heading )

-
place a single cloud

-
-

local_weather.create_impostor ( path, lat, long, alt, heading )

-
place an impostor sheet

-
-

local_weather.place_model ( path, lat, lon, alt, heading, pitch, yaw )

-
place a model

-
-

local_weather.place_model_controlled ( string, path, lat, lon, alt, heading, pitch, roll )

-
place a model with control properties

-
-

local_weather.create_cloud_new ( c )

-
place a single cloud using hard-coded system

-
-

local_weather.create_cloud_array ( i, clouds_path, clouds_lat, clouds_lon, clouds_alt, clouds_orientation )

-
place a cloud layer from arrays, split across frames

-
-

local_weather.create_new_cloud_array ( i, cloudArray )

-
-

local_weather.get_elevation ( lat, lon )

-
get terrain elevation

-
-

local_weather.get_elevation_array ( lat, lon )

-
get terrain elevation vector

-
-

local_weather.set_wxradarecho_storm ( lat, lon, base, top, radius, ref, turb, type )

-
set the wxradar echo of a storm

-
-

local_weather.remove_wxradar_echos ( )

-
remove unused echos

-
-

local_weather.features

-
available hard-coded support

-
-

local_weather.calc_geo ( clat )

-
geospatial helper functions

-
-

local_weather.calc_d_sq ( lat1, lon1, lat2, lon2 )

-
-

local_weather.effect_volume_loop ( index, n_active )

-
effect volume management loop

-
-

local_weather.assemble_effect_array ( )

-
assemble effect volume array

-
-

local_weather.add_vectors ( phi1, r1, phi2, r2 )

-
vector addition

-
-

local_weather.wind_altitude_interpolation ( altitude, w )

-
windfield altitude interpolation

-
-

local_weather.wind_interpolation ( lat, lon, alt )

-
windfield spatial interpolation

-
-

local_weather.get_slowdown_fraction ( )

-
boundary layer computations

-
-

local_weather.interpolation_loop ( )

-
interpolation management loop

-
-

local_weather.thermal_lift_start ( ev )

-
thermal lift loop startup

-
-

local_weather.thermal_lift_loop ( )

-
thermal lift loop

-
-

local_weather.thermal_lift_stop ( )

-
thermal lift loop stop

-
-

local_weather.wave_lift_start ( ev )

-
wave lift loop startup

-
-

local_weather.wave_lift_loop ( )

-
wave lift loop

-
-

local_weather.wave_lift_stop ( )

-
wave lift loop stop

-
-

local_weather.effect_volume_start ( ev )

-
action taken when in effect volume

-
-

local_weather.effect_volume_stop ( ev )

-
-

local_weather.ts_factor ( t, alt, height )

-
compute thermal lift in detailed model

-
-

local_weather.tl_factor ( t, alt, height )

-
-

local_weather.calcLift_max ( alt, max_lift, height )

-
-

local_weather.calcLift ( d, alt, R, height, cn, sh, max_lift, f_lift_radius, t )

-
-

local_weather.calcWaveLift ( x,y, alt )

-
compute wave lift in detailed model

-
-

local_weather.create_cloud_vec ( path, lat, lon, alt, heading )

-
place a single cloud into a vector to be processed

-
separately

-
-

local_weather.clear_all ( )

-
clear all clouds and effects

-
-

local_weather.create_detailed_cumulus_cloud ( lat, lon, alt, size )

-
detailed Cumulus clouds created from multiple cloudlets

-
-

local_weather.create_cumulonimbus_cloud ( lat, lon, alt, size )

-
detailed small Cumulonimbus clouds created from multiple cloudlets

-
-

local_weather.create_cumulonimbus_cloud_rain ( lat, lon, alt, size, rain )

-
detailed small Cumulonimbus and rain created from multiple cloudlets

-
-

local_weather.create_cumosys ( blat, blon, balt, nc, size )

-
wrappers for convective cloud system to distribute

-
call across several frames if needed

-
-

local_weather.cumulus_loop ( blat, blon, balt, nc, size )

-
-

local_weather.create_cumulus ( blat, blon, balt, nc, size )

-
place a convective cloud system

-
-

local_weather.recreate_cumulus ( blat, blon, balt, alpha, nc, size, tile_index )

-
respawn convective clouds to compensate for decay

-
the difference being that new clouds get zero fractional

-
lifetime and are placed based on terrain with a different weight

-
-

local_weather.create_rise_clouds ( blat, blon, balt, nc, size, winddir, dist )

-
place a barrier cloud system

-
-

local_weather.create_streak ( type, blat, blong, balt, alt_var, nx, xoffset, edgex, x_var, ny, yoffset, edgey, y_var, direction, tri )

-
place a cloud streak

-
-

local_weather.create_hollow_layer ( type, blat, blon, balt, bthick, rx, ry, phi, density, edge, gap_fraction )

-
place a cloud layer with a gap in the middle

-
(useful to reduce cloud count in large thunderstorms)

-
-

local_weather.create_cloudbox ( type, blat, blon, balt, dx,dy,dz,n, f_core, r_core, h_core, n_core, f_bottom, h_bottom, n_bottom )

-
place a cloud box

-
-

local_weather.terrain_presampling_start ( blat, blon, nc, size, alpha )

-
terrain presampling initialization

-
-

local_weather.terrain_presampling_loop ( blat, blon, nc, size, alpha )

-
terrain presampling loop

-
-

local_weather.terrain_presampling ( blat, blon, ntries, size, alpha )

-
terrain presampling routine

-
-

local_weather.terrain_presampling_analysis ( )

-
terrain presampling analysis

-
-

local_weather.wave_detection_loop ( blat, blon, nx, alpha )

-
wave conditions search

-
-

local_weather.get_convective_altitude ( balt, elevation, tile_index, grad )

-
detailed altitude determination for convective calls

-
clouds follow the terrain to some degree, but not excessively so

-
-

local_weather.get_terrain_gradient ( lat, lon, elevation1, phi, dist )

-
detailed terrain gradient determination in wind direction

-
-

local_weather.get_gradient_factor ( grad )

-
enhancement of the placement altitude due to terrain

-
-

local_weather.get_lee_bias ( grad, tile_index )

-
suppression of placement in lee terrain

-
-

local_weather.get_terrain_altitude_factor ( tile_index, balt, elevation )

-
enhancement of Cumulus in above average altitude

-
-

local_weather.get_terrain_strength_factor ( terrain_altitude_factor )

-
-

local_weather.manage_presampling ( )

-
terrain presampling listener dispatcher

-
-

local_weather.manage_hardcoded_presampling ( )

-
hardcoded terrain presampling listener dispatcher

-
-

local_weather.set_wind_model_flag ( )

-
set wind model flag

-
-

local_weather.set_texture_mix ( )

-
set texture mix for convective clouds

-
-

local_weather.create_effect_volume ( geometry, lat, lon, r1, r2, phi, alt_low, alt_high, vis, rain, snow, turb, lift, lift_flag, sat )

-
create an effect volume

-
-

local_weather.set_weather_station ( lat, lon, alt, vis, T, D, p )

-
set a weather station for interpolation

-
-

local_weather.set_atmosphere_ipoint ( lat, lon, vis_aloft, vis_alt1, vis_ovcst, ovcst,ovcst_alt_low, ovcst_alt_high, scatt, scatt_alt_low, scatt_alt_high )

-
set an atmosphere condition point for interpolation

-
-

local_weather.set_wind_ipoint ( lat, lon, d0, v0, d1, v1, d2, v2, d3, v3, d4, v4, d5, v5, d6, v6, d7, v7, d8, v8 )

-
set a wind interpolation point

-
-

local_weather.set_wind_ipoint_metar ( lat, lon, d0, v0 )

-
set a wind interpolation point from ground METAR data

-
-

local_weather.showDialog ( name )

-
helper to show additional dialogs

-
-

local_weather.readFlags ( )

-
helper to transfer configuration flags in menu to Nasal

-
-

local_weather.streak_wrapper ( )

-
wrappers to call functions from the local weather menu bar

-
-

local_weather.convection_wrapper ( )

-
-

local_weather.barrier_wrapper ( )

-
-

local_weather.single_cloud_wrapper ( )

-
-

local_weather.layer_wrapper ( )

-
-

local_weather.box_wrapper ( )

-
-

local_weather.set_aloft_wrapper ( )

-
-

local_weather.set_tile ( )

-
tile setup call wrapper

-
-

local_weather.startup ( )

-
Anything that needs to run at startup goes here

-
-

local_weather.test ( )

-
Standard test call (for development and debug only)

-
-

local_weather.weatherStation

-
object classes

-
-

local_weather.weatherStation.new ( lat, lon, alt, vis, T, D, p )

-
-

local_weather.weatherStation.move ( )

-
-

local_weather.atmosphereIpoint

-
-

local_weather.atmosphereIpoint.new ( lat, lon, vis_aloft, vis_alt1, vis_ovcst, ovcst, ovcst_alt_low, ovcst_alt_high, scatt, scatt_alt_low, scatt_alt_high )

-
-

local_weather.atmosphereIpoint.move ( )

-
-

local_weather.windIpoint

-
-

local_weather.windIpoint.new ( lat, lon, d0, v0, d1, v1, d2, v2, d3, v3, d4, v4, d5, v5, d6, v6, d7, v7, d8, v8 )

-
-

local_weather.windVec

-
-

local_weather.windVec.new ( d, v )

-
-

local_weather.effectVolume

-
-

local_weather.effectVolume.new ( geometry, lat, lon, r1, r2, phi, alt_low, alt_high, vis, rain, snow, turb, lift, lift_flag, sat )

-
-

local_weather.effectVolume.move ( )

-
-

local_weather.effectVolume.correct_altitude ( )

-
-

local_weather.effectVolume.correct_altitude_and_age ( )

-
-

local_weather.effectVolume.get_distance ( )

-
-

local_weather.thermalLift

-
-

local_weather.thermalLift.new ( lat, lon, radius, height, cn, sh, max_lift, f_lift_radius )

-
-

local_weather.thermalLift.move ( )

-
-

local_weather.thermalLift.correct_altitude ( )

-
-

local_weather.thermalLift.correct_altitude_and_age ( )

-
-

local_weather.waveLift

-
-

local_weather.waveLift.new ( lat, lon, x, y, phi, height, max_lift )

-
-

local_weather.thermal

-
global weather hashes

-
-

local_weather.wave

-
-

local_weather.interpolated_conditions

-
-

local_weather.current_conditions

-
-

local_weather.tracerAssembly

-
-

local_weather.updateMenu ( )

-
-

local_weather.seaColorPoint

-
object classes

-
-

local_weather.seaColorPoint.new ( lat, lon, weight, deep_r, deep_g, deep_b )

-
-

local_weather.init_sea_colors ( )

-
functions

-
-

local_weather.sea_color_loop ( index )

-
-

local_weather.get_windfield ( tile_index )

-
get the windfield for a given location and altitude

-
(currently constant, but supposed to be local later)

-
-

local_weather.get_wind_direction ( tile_index )

-
-

local_weather.get_wind_speed ( tile_index )

-
-

local_weather.timing_loop ( )

-
timing loop

-
this gets the accurate time since the start of weather dynamics

-
and hence the timestamps for cloud evolution since

-
the available elapsed-time-sec is not accurate enough

-
-

local_weather.quadtree_loop ( )

-
quadtree loop

-
the quadtree loop is a fast loop updating the position

-
of visible objects in the field of view only

-
-

local_weather.weather_dynamics_loop ( index, cindex )

-
weather_dynamics_loop

-
the weather dynamics loop is a slow loop updating

-
position and state of invisible objects, currently

-
effect volumes and weather stations

-
-

local_weather.convective_loop ( )

-
convective evolution loop

-
-

local_weather.generate_quadtree_structure ( depth, tree_base_vec )

-
generate quadtree structure

-
-

local_weather.sort_into_quadtree ( blat, blon, alpha, lat, lon, tree, object )

-
sort into quadtree

-
-

local_weather.sorting_recursion ( x, y, tree, object, depth )

-
-

local_weather.quadtree_recursion ( tree, depth, flag, qx, qy )

-
quadtree recursive search

-
-

local_weather.check_visibility ( qx,qy, length_scale )

-
quadrant visibility test

-
-

local_weather.move_tile ( t )

-
move a tile

-
-

local_weather.get_cartesian ( blat, blon, alpha, lat, lon )

-
get local Cartesian coordinates

-
-

local_weather.tile_start ( )

-
routines to set up weather tiles

-
Thorsten Renk, June 2011

-
function purpose

-
tile_start to execute jobs common for all tiles on startup

-
tile_finished to execute jobs common for all tiles when tile creation is done

-
set_NN_tile to set a weather tile of type NN

-
create_NN to create the cloud configuration NN

-
adjust_p to make sure pressure variation cannot exceed limits between tiles

-
calc_geo to get local Cartesian geometry for latitude conversion

-
get_lat to get latitude from Cartesian coordinates

-
get_lon to get longitude from Cartesian coordinates

-
tile setup calls

-
-

local_weather.tile_finished ( )

-
-

local_weather.set_4_8_stratus_tile ( )

-
test tile

-
-

local_weather.set_high_pressure_core_tile ( )

-
high pressure core

-
-

local_weather.set_high_pressure_tile ( )

-
high pressure

-
-

local_weather.set_high_pressure_border_tile ( )

-
high pressure border

-
-

local_weather.set_low_pressure_border_tile ( )

-
low pressure border

-
-

local_weather.set_low_pressure_tile ( )

-
low pressure

-
-

local_weather.set_low_pressure_core_tile ( )

-
low pressure core

-
-

local_weather.set_cold_sector_tile ( )

-
cold sector

-
-

local_weather.set_warm_sector_tile ( )

-
Warm sector

-
-

local_weather.set_tropical_weather_tile ( )

-
Tropical weather

-
-

local_weather.set_thunderstorms_tile ( )

-
Thunderstorms

-
-

local_weather.set_coldfront_tile ( )

-
Coldfront

-
-

local_weather.set_warmfront1_tile ( )

-
Warmfront 1

-
-

local_weather.set_warmfront2_tile ( )

-
Warmfront 2

-
-

local_weather.set_warmfront3_tile ( )

-
Warmfront 3

-
-

local_weather.set_warmfront4_tile ( )

-
Warmfront 4

-
-

local_weather.set_METAR_tile ( )

-
METAR

-
-

local_weather.set_METAR_weather_station ( )

-
METAR station setup

-
-

local_weather.create_8_8_tstratus ( lat, lon, alt, alpha )

-
mid-level cloud setup calls

-
-

local_weather.create_8_8_cirrostratus ( lat, lon, alt, alpha )

-
-

local_weather.create_8_8_nimbus ( lat, lon, alt, alpha )

-
-

local_weather.create_8_8_nimbus_var1 ( lat, lon, alt, alpha )

-
-

local_weather.create_8_8_nimbus_var2 ( lat, lon, alt, alpha )

-
-

local_weather.create_8_8_nimbus_var3 ( lat, lon, alt, alpha )

-
-

local_weather.create_8_8_nimbus_rain ( lat, lon, alt, alpha, rain )

-
-

local_weather.create_8_8_stratus ( lat, lon, alt, alpha )

-
-

local_weather.create_8_8_stratus_rain ( lat, lon, alt, alpha, rain )

-
-

local_weather.create_6_8_stratus ( lat, lon, alt, alpha )

-
-

local_weather.create_6_8_nimbus_rain ( lat, lon, alt, alpha, rain )

-
-

local_weather.create_6_8_stratus_rain ( lat, lon, alt, alpha, rain )

-
-

local_weather.create_6_8_stratus_undulatus ( lat, lon, alt, alpha )

-
-

local_weather.create_6_8_tstratus_undulatus ( lat, lon, alt, alpha )

-
-

local_weather.create_6_8_tstratus_mackerel ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_6_8_cirrostratus ( lat, lon, alt, alpha )

-
-

local_weather.create_6_8_stratocumulus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_stratus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_stratus_patches ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_tstratus_patches ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_tstratus_domains ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_4_8_sstratus_patches ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_cirrostratus_patches ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_cirrostratus_undulatus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_stratus_undulatus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_tstratus_undulatus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_sstratus_undulatus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_cirrocumulus_bank ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_cirrocumulus_undulatus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_cirrocumulus_streaks ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_altocumulus_perlucidus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_alttstratus_streaks ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_alttstratus_patches ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_stratocumulus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_cumulus_alleys ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_small_cumulus_alleys ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_cirrus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_sstratus_bundle ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_4_8_sstratus_domains ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_4_8_cirrus_bundle ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_4_8_alttstratus_domains ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_2_8_sstratus_bundle ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_2_8_sstratus_hires_bundle ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_2_8_cirrostratus_mackerel ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_2_8_perlucidus_mackerel ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_2_8_alttstratus_domains ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_2_8_altocumulus_domains ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_2_8_altocumulus_perlucidus_domains ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_2_8_cirrocumulus_domains ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_2_8_stratus ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_tstratus ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_sstratus ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_altocumulus_perlucidus ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_sstratus_streak ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_cirrostratus ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_cirrocumulus ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_cirrus ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_alttstratus ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_altocumulus_streaks ( lat, lon, alt, alpha )

-
-

local_weather.create_1_8_cirrocumulus_mackerel ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_1_8_alttstratus_domains ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_1_8_altocumulus_scattered ( lat, lon, alt, alpha )

-
-

local_weather.create_1_8_cirrocumulus ( lat, lon, alt, alpha )

-
-

local_weather.create_1_8_cirrus ( lat, lon, alt, alpha )

-
-

local_weather.create_1_8_cirrus_bundle ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_1_8_cirrostratus_undulatus ( lat, lon, alt, alpha )

-
-

local_weather.create_1_8_contrails ( lat, lon, alt, alpha )

-
-

local_weather.create_thunderstorm_scenario ( lat, lon, alt, alpha )

-
-

local_weather.create_stratocumulus_bank ( lat, lon, alt, alpha )

-
-

local_weather.create_detailed_stratocumulus_bank ( lat, lon, alt, alpha )

-
-

local_weather.create_detailed_small_stratocumulus_bank ( lat, lon, alt, alpha )

-
-

local_weather.create_cloud_bank ( type, lat, lon, alt, x1, x2, height, n, alpha )

-
-

local_weather.create_small_thunderstorm ( lat, lon, alt, alpha )

-
-

local_weather.create_medium_thunderstorm ( lat, lon, alt, alpha )

-
-

local_weather.create_big_thunderstorm ( lat, lon, alt, alpha )

-
-

local_weather.create_noctilucent_patch ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_cirrocumulus_patches ( lat, lon, alt, alpha )

-
-

local_weather.create_impostor_ring ( lat, lon, alt, alpha, type, n )

-
-

local_weather.calc_geo ( clat )

-
helper functions

-
-

local_weather.get_lat ( x,y,phi )

-
-

local_weather.get_lon ( x,y,phi )

-
-

local_weather.get_n ( strength )

-
-

local_weather.adjust_p ( p )

-
continuity condition of pressure

-
-

local_weather.tile_management_loop ( )

-
object purpose

-
cloud to provide the data hash for the new cloud rendering system

-
cloudBuffer to store a cloud in a Nasal buffer, to provide methods to move it

-
cloudScenery to store info for clouds in scenery, to provide methods to move and evolve them

-
cloudImpostor to provide the hash data for an impostor cloud sheet

-
tile management loop

-
-

local_weather.generate_tile ( code, lat, lon, dir_index )

-
tile generation call

-
-

local_weather.remove_tile ( index )

-
tile removal call

-
-

local_weather.change_active_tile ( index )

-
active tile change and neighbour

-
recomputation

-
-

local_weather.rotate_tile_scheme ( angle )

-
rotate tile scheme

-
-

local_weather.copy_entry ( from_index, to_index )

-
copy tile info in neighbour matrix

-
-

local_weather.create_neighbour ( blat, blon, index, alpha )

-
create adjacent tile coordinates

-
-

local_weather.create_neighbours ( blat, blon, alpha )

-
find the 8 adjacent tile coordinates

-
after the initial setup call

-
-

local_weather.housekeeping_loop ( index, index1 )

-
housekeeping loop

-
-

local_weather.remove_impostors ( )

-
-

local_weather.create_impostors ( )

-
-

local_weather.thunderstorm_management_loop ( )

-
Thunderstorm positon management

-
-

local_weather.lightning_strike ( )

-
-

local_weather.shadow_management_loop ( index )

-
Cloud shadow management

-
-

local_weather.watchdog_loop ( )

-
watchdog loop for debugging

-
-

local_weather.cloudBuffer

-
-

local_weather.cloudBuffer.new ( lat, lon, alt, path, orientation, index, type )

-
-

local_weather.cloudBuffer.get_distance ( )

-
-

local_weather.cloudBuffer.get_course ( )

-
-

local_weather.cloudBuffer.show ( )

-
-

local_weather.cloudBuffer.move ( )

-
-

local_weather.cloudImpostor

-
-

local_weather.cloudImpostor.new ( modelNode )

-
-

local_weather.cloudImpostor.removeNodes ( )

-
-

local_weather.cloudShadow

-
-

local_weather.cloudShadow.new ( lat, lon, size, strength )

-
-

local_weather.thunderstormHash

-
-

local_weather.thunderstormHash.new ( lat, lon, alt, size, strength )

-
-

local_weather.cloudScenery

-
-

local_weather.cloudScenery.new ( index, type, cloudNode, modelNode )

-
-

local_weather.cloudScenery.removeNodes ( )

-
-

local_weather.cloudScenery.to_buffer ( )

-
-

local_weather.cloudScenery.get_distance ( )

-
-

local_weather.cloudScenery.get_course ( )

-
-

local_weather.cloudScenery.get_altitude ( )

-
-

local_weather.cloudScenery.correct_altitude ( )

-
-

local_weather.cloudScenery.correct_altitude_and_age ( )

-
-

local_weather.cloudScenery.to_target_alt ( )

-
-

local_weather.cloudScenery.move ( )

-
-

local_weather.cloudScenery.show ( )

-
-

local_weather.cloud

-
-

local_weather.cloud.new ( type, subtype )

-
-

local_weather.cloud.remove ( )

-
-

local_weather.cloud.move ( )

-
-

local_weather.cloud.correct_altitude ( )

-
-

local_weather.calc_geo ( clat )

-
helper functions

-
-

local_weather.get_lat ( x,y,phi )

-
-

local_weather.get_lon ( x,y,phi )

-
-

local_weather.relangle ( alpha, beta )

-
-

local_weather.norm_relangle ( alpha, beta )

-
-

local_weather.delete_from_vector ( vec, index )

-
-
-

performance_monitor

-

performance_monitor.dialog

-
-

performance_monitor.dialog.init ( x = nil, y = nil )

-
-

performance_monitor.dialog.create ( )

-
-

performance_monitor.dialog.update ( id )

-
-

performance_monitor.dialog._redraw_ ( )

-
-

performance_monitor.dialog.close ( )

-
-

performance_monitor.dialog.del ( )

-
-

performance_monitor.dialog.show ( )

-
-

performance_monitor.dialog.toggle ( )

-
-
-

std

-

std.string

-
-

std.string.new ( str )

-
public:

-
-

std.string.compare ( )

-
compare(s)

-
compare(pos, n, s)

-
@param s String to compare to

-
@param pos Position of first character used to compare

-
@param n Number of characters to compare

-
-

std.string.find_first_of ( s, pos = 0 )

-
-

std.string.find ( s, pos = 0 )

-
-

std.string.find_first_not_of ( s, pos = 0 )

-
-

std.string.substr ( pos, len = nil )

-
-

std.string.starts_with ( s )

-
-

std.string.size ( )

-
-

std.string._eq ( pos, s )

-
private:

-
-

std.string._find ( first, last, s, eq )

-
-

std.stoul ( str, base = 10 )

-
converts a string to an unsigned integer

-
-

std.min ( a, b )

-
Copyright (C) 2014 onox

-
This program is free software: you can redistribute it and/or modify

-
it under the terms of the GNU General Public License as published by

-
the Free Software Foundation; either version 2 of the License, or

-
(at your option) any later version.

-
This program is distributed in the hope that it will be useful,

-
but WITHOUT ANY WARRANTY; without even the implied warranty of

-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

-
GNU General Public License for more details.

-
You should have received a copy of the GNU General Public License

-
along with this program. If not, see <http://www.gnu.org/licenses/>.

-
-

std.max ( a, b )

-
-

std.Vector

-
-

std.Vector.new ( vector=nil )

-
-

std.Vector.size ( )

-
-

std.Vector.clear ( )

-
-

std.Vector.append ( item )

-
-

std.Vector.extend ( other_vector )

-
-

std.Vector.insert ( index, item )

-
-

std.Vector.pop ( index=nil )

-
-

std.Vector.index ( item )

-
-

std.Vector.contains ( item )

-
-

std.Vector.remove ( item )

-
-
-

towing

-

towing.towing ( )

-
main function

-
-

towing.findBestAIObject ( )

-
find best AI object

-
-

towing.aerotow ( open )

-
aerotow function

-
-

towing.winch ( open )

-
winch function

-
-

towing.createTowrope ( device )

-
create towrope

-
-

towing.getFreeModelID ( )

-
get the next free id of "models/model" members

-
-

towing.closeHitch ( )

-
close aerotow hitch

-
-

towing.releaseHitch ( device )

-
release hitch

-
-

towing.removeTowrope ( device )

-
remove/delete towrope

-
-

towing.pull_in_rope ( )

-
pull in towrope after hitch has been opened

-
-

towing.setAIObjectDefaults ( )

-
set some AI-object default values

-
-

towing.setWinchPositionAuto ( )

-
place winch model

-
-

towing.runWinch ( )

-
clutch / un-clutch winch

-
-

towing.releaseWinch ( )

-
release winch

-
-

towing.assignHitchLocations ( device )

-
assignHitchLocations

-
-

towing.PointRotate3D ( x,y,z,xr,yr,zr,alpha_deg,beta_deg,gamma_deg )

-
point transformation

-
-
-

tutorial

-

tutorial.startTutorial ( )

-
-

tutorial.stopTutorial ( )

-
-

tutorial.step_tutorial ( id )

-
- Gets the current step node from the tutorial

-
- If this is the first time the step is entered, it displays the instruction message

-
- Otherwise, it

-
- Checks if the exit conditions have been met. If so, it increments the step counter.

-
- Checks for any error conditions, in which case it displays a message to the screen and

-
increments an error counter

-
- Otherwise display the instructions for the step.

-
-

tutorial.do_group ( node, default_msg = nil )

-
Do the stuff that's shared by <init>, <step>, <error>, <exit>, and <abort>.

-
<end> doesn't use it.

-
-

tutorial.read_int ( node, child, default )

-
-

tutorial.set_properties ( node )

-
scan all <set> blocks and set their <property> to <value> or

-
the value of a property that <property n="1"> points to

-
<set>

-
<property>/foo/bar</property>

-
<value>woof</value>

-
</set>

-
-

tutorial.set_targets ( node )

-
For each <target><*><longitude-deg|latitude-deg> calculate and update

-
/sim/tutorials/targets/*/...

-
heading-deg ... absolute heading to target (0 -> North)

-
direction-deg ... relative angle to target (0 -> ahead, 90 -> to the right)

-
distance-m ... distance in meters

-
eta-min ... estimated time of arrival (assuming aircraft flies in

-
in current speed towards target)

-
-

tutorial.set_models ( node )

-
-

tutorial.remove_models ( )

-
-

tutorial.set_view ( node = nil )

-
-

tutorial.set_marker ( node = nil )

-
-

tutorial.is_running ( which = nil )

-
Set and return running state. Disable/enable stop menu.

-
-

tutorial.say_message ( node, default = nil )

-
-

tutorial.shuffle ( vec )

-
-

tutorial.run_nasal ( node )

-
-

tutorial.say ( what, who = )

-
-

tutorial.init_nasal ( )

-
Set up namespace "__tutorial" for embedded Nasal.

-
-

tutorial.dialog ( )

-
-

tutorial.load ( file, index = 0 )

-
Tutorial loader for development purposes.

-
Usage: tutorial.load("Aircraft/bo105/Tutorials/foo.xml", 1)

-
- \ No newline at end of file diff --git a/archives/nasal_api_doc-py2-2019.1.1.html b/archives/nasal_api_doc-py2-2019.1.1.html deleted file mode 100644 index edfcd84..0000000 --- a/archives/nasal_api_doc-py2-2019.1.1.html +++ /dev/null @@ -1,5513 +0,0 @@ - Nasal API -

Nasal $FGROOT Library
Flightgear version: 2019.1.1
This file is generated automatically by scripts/python/nasal_api_doc.py


Nasal documentation   Flightgear Nasal documentation - -
-

addons

-

addons._listeners

-
hashes to store listeners and timers per addon ID

-
-

addons._timers

-
-

addons.getNamespaceName ( a )

-
-

addons.load ( a )

-
-

addons.remove ( a )

-
-

addons._reloadFlags

-
-

addons.reload ( a )

-
-

addons.init ( )

-
-
-

aircraft

-

aircraft.makeNode ( n )

-
creates (if necessary) and returns a property node from arg[0],

-
which can be a property node already, or a property path

-
-

aircraft.optarg ( args, index, default )

-
returns args[index] if available and non-nil, or default otherwise

-
-

aircraft.door

-
door

-
class for objects moving at constant speed, with the ability to

-
reverse moving direction at any point. Appropriate for doors, canopies, etc.

-
SYNOPSIS:

-
door.new(<property>, <swingtime> [, <startpos>]);

-
property ... door node: property path or node

-
swingtime ... time in seconds for full movement (0 -> 1)

-
startpos ... initial position (default: 0)

-
PROPERTIES:

-
./position-norm (double) (default: <startpos>)

-
./enabled (bool) (default: 1)

-
EXAMPLE:

-
var canopy = aircraft.door.new("sim/model/foo/canopy", 5);

-
canopy.open();

-
-

aircraft.door.new ( node, swingtime, pos = 0 )

-
-

aircraft.door.enable ( v )

-
door.enable(bool) -> set ./enabled

-
-

aircraft.door.setpos ( pos )

-
door.setpos(double) -> set ./position-norm without movement

-
-

aircraft.door.getpos ( )

-
double door.getpos() -> return current position as double

-
-

aircraft.door.close ( )

-
door.close() -> move to closed state

-
-

aircraft.door.open ( )

-
door.open() -> move to open state

-
-

aircraft.door.toggle ( )

-
door.toggle() -> move to opposite end position

-
-

aircraft.door.stop ( )

-
door.stop() -> stop movement

-
-

aircraft.door.move ( target )

-
door.move(double) -> move to arbitrary position

-
-

aircraft.light

-
light

-
class for generation of pulsing values. Appropriate for controlling

-
beacons, strobes, etc.

-
SYNOPSIS:

-
light.new(<property>, <pattern> [, <switch>]);

-
light.new(<property>, <stretch>, <pattern> [, <switch>]);

-
property ... light node: property path or node

-
stretch ... multiplicator for all pattern values

-
pattern ... array of on/off time intervals (in seconds)

-
switch ... property path or node to use as switch (default: ./enabled)

-
instead of ./enabled

-
PROPERTIES:

-
./state (bool) (default: 0)

-
./enabled (bool) (default: 0) except if <switch> given)

-
EXAMPLES:

-
aircraft.light.new("sim/model/foo/beacon", [0.4, 0.4]); anonymous light

-
-------

-
var strobe = aircraft.light.new("sim/model/foo/strobe", [0.05, 0.05, 0.05, 1],

-
"controls/lighting/strobe");

-
strobe.switch(1);

-
-------

-
var switch = props.globals.getNode("controls/lighting/strobe", 1);

-
var pattern = [0.02, 0.03, 0.02, 1];

-
aircraft.light.new("sim/model/foo/strobe-top", 1.001, pattern, switch);

-
aircraft.light.new("sim/model/foo/strobe-bot", 1.005, pattern, switch);

-
-

aircraft.light.new ( )

-
-

aircraft.light.del ( )

-
class destructor

-
-

aircraft.light.switch ( v )

-
light.switch(bool) -> set light switch (also affects other lights

-
that use the same switch)

-
-

aircraft.light.toggle ( )

-
light.toggle() -> toggle light switch

-
-

aircraft.light.cont ( )

-
light.cont() -> continuous light

-
-

aircraft.light.blink ( count = -1, endstate = 0 )

-
light.blink() -> blinking light (default)

-
light.blink(3) -> when switched on, only run three blink sequences;

-
second optional arg defines state after the sequences

-
-

aircraft.light._switch_ ( )

-
-

aircraft.light._loop_ ( id )

-
-

aircraft.lowpass

-
lowpass

-
class that implements a variable-interval EWMA (Exponentially Weighted

-
Moving Average) lowpass filter with characteristics independent of the

-
frame rate.

-
SYNOPSIS:

-
lowpass.new(<coefficient>);

-
EXAMPLE:

-
var lp = aircraft.lowpass.new(1.5);

-
print(lp.filter(10)); prints 10

-
print(lp.filter(0));

-
-

aircraft.lowpass.new ( coeff )

-
-

aircraft.lowpass.filter ( v )

-
filter(raw_value) -> push new value, returns filtered value

-
-

aircraft.lowpass.get ( )

-
get() -> returns filtered value

-
-

aircraft.lowpass.set ( v )

-
set() -> sets new average and returns it

-
-

aircraft.lowpass._filter_ ( v )

-
-

aircraft.angular_lowpass

-
angular lowpass

-
same as above, but for angles. Filters sin/cos separately and calculates the

-
angle again from them. This avoids unexpected jumps from 179.99 to -180 degree.

-
-

aircraft.angular_lowpass.new ( coeff )

-
-

aircraft.angular_lowpass.filter ( v )

-
-

aircraft.angular_lowpass.set ( v )

-
-

aircraft.angular_lowpass.get ( )

-
-

aircraft.data

-
class that loads and saves properties to aircraft-specific data files in

-
~/.fgfs/aircraft-data/ (Unix) or %APPDATA%\flightgear.org\aircraft-data\.

-
There's no public constructor, as the only needed instance gets created

-
by the system.

-
SYNOPSIS:

-
data.add(<properties>);

-
data.save([<interval>])

-
properties ... about any combination of property nodes (props.Node)

-
or path name strings, or lists or hashes of them,

-
lists of lists of them, etc.

-
interval ... save in <interval> minutes intervals, or only once

-
if 'nil' or empty (and again at reinit/exit)

-
SIGNALS:

-
/sim/signals/save ... set to 'true' right before saving. Can be used

-
to update values that are to be saved

-
EXAMPLE:

-
var p = props.globals.getNode("/sim/model", 1);

-
var vec = [p, p];

-
var hash = {"foo": p, "bar": p};

-
add properties

-
aircraft.data.add("/sim/fg-root", p, "/sim/fg-home");

-
aircraft.data.add(p, vec, hash, "/sim/fg-root");

-
now save only once (and at exit/reinit, which is automatically done)

-
aircraft.data.save();

-
or save now and every 30 sec (and at exit/reinit)

-
aircraft.data.save(0.5);

-
-

aircraft.data.init ( )

-
-

aircraft.data.load ( )

-
-

aircraft.data.save ( v = nil )

-
-

aircraft.data._loop_ ( id )

-
-

aircraft.data._save_ ( )

-
-

aircraft.data.add ( p... )

-
-

aircraft.timer

-
timer

-
class that implements timer that can be started, stopped, reset, and can

-
have its value saved to the aircraft specific data file. Saving the value

-
is done automatically by the aircraft.Data class.

-
SYNOPSIS:

-
timer.new(<property> [, <resolution:double> [, <save:bool>]])

-
<property> ... property path or props.Node hash that holds the timer value

-
<resolution> ... timer update resolution -- interval in seconds in which the

-
timer property is updated while running (default: 1 s)

-
<save> ... bool that defines whether the timer value should be saved

-
and restored next time, as needed for Hobbs meters

-
(default: 1)

-
EXAMPLES:

-
var hobbs_turbine = aircraft.timer.new("/sim/time/hobbs/turbine[0]", 60);

-
hobbs_turbine.start();

-
aircraft.timer.new("/sim/time/hobbs/battery", 60).start(); anonymous timer

-
-

aircraft.timer.new ( prop, res = 1, save = 1 )

-
-

aircraft.timer.del ( )

-
-

aircraft.timer.start ( )

-
-

aircraft.timer.stop ( )

-
-

aircraft.timer.reset ( )

-
-

aircraft.timer._apply_ ( )

-
-

aircraft.timer._save_ ( )

-
-

aircraft.timer._loop_ ( id )

-
-

aircraft.livery

-
livery

-
Class that maintains livery XML files (see English Electric Lightning for an

-
example). The last used livery is saved on exit and restored next time. Livery

-
files are regular PropertyList XML files whose properties are copied to the

-
main tree.

-
SYNOPSIS:

-
livery.init(<livery-dir> [, <name-path> [, <sort-path>]]);

-
<livery-dir> ... directory with livery XML files, relative to $FG_ROOT

-
<name-path> ... property path to the livery name in the livery files

-
and the property tree (default: sim/model/livery/name)

-
<sort-path> ... property path to the sort criterion (default: same as

-
<name-path> -- that is: alphabetic sorting)

-
EXAMPLE:

-
aircraft.livery.init("Aircraft/Lightning/Models/Liveries",

-
"sim/model/livery/variant",

-
"sim/model/livery/index"); optional

-
aircraft.livery.dialog.toggle();

-
aircraft.livery.select("OEBH");

-
aircraft.livery.next();

-
-

aircraft.livery.init ( dir, nameprop = )

-
-

aircraft.livery_update

-
livery_update

-
Class for maintaining liveries in MP aircraft. It is used in Nasal code that's

-
embedded in aircraft animation XML files, and checks in intervals whether the

-
parent aircraft has changed livery, in which case it changes the livery

-
in the remote aircraft accordingly. This class is a wrapper for overlay_update.

-
SYNOPSIS:

-
livery_update.new(<livery-dir> [, <interval:10> [, <func>]]);

-
<livery-dir> ... directory with livery files, relative to $FG_ROOT

-
<interval> ... checking interval in seconds (default: 10)

-
<func> ... callback function that's called with the ./sim/model/livery/file

-
contents as argument whenever the livery has changed. This can

-
be used for post-processing.

-
EXAMPLE:

-
<nasal>

-
<load>

-
var livery_update = aircraft.livery_update.new(

-
"Aircraft/R22/Models/Liveries", 30,

-
func print("R22 livery update"));

-
</load>

-
<unload>

-
livery_update.stop();

-
</unload>

-
</nasal>

-
-

aircraft.livery_update.new ( liveriesdir, interval = 10.01, callback = nil )

-
-

aircraft.livery_update.stop ( )

-
-

aircraft.overlay_update

-
overlay_update

-
Class for maintaining overlays in MP aircraft. It is used in Nasal code that's

-
embedded in aircraft animation XML files, and checks in intervals whether the

-
parent aircraft has changed an overlay, in which case it copies the respective

-
overlay to the aircraft's root directory.

-
SYNOPSIS:

-
livery_update.new();

-
livery_update.add(<overlay-dir>, <property> [, <callback>]);

-
<overlay-dir> ... directory with overlay files, relative to $FG_ROOT

-
<property> ... MP property where the overlay file name can be found

-
(usually one of the sim/multiplay/generic/string properties)

-
<callback> ... callback function that's called with two arguments:

-
the file name (without extension) and the overlay directory

-
EXAMPLE:

-
<nasal>

-
<load>

-
var update = aircraft.overlay_update.new();

-
update.add("Aircraft/F4U/Models/Logos", "sim/multiplay/generic/string");

-
</load>

-
<unload>

-
update.stop();

-
</unload>

-
</nasal>

-
-

aircraft.overlay_update.new ( )

-
-

aircraft.overlay_update.add ( path, prop, callback = nil )

-
-

aircraft.overlay_update.stop ( )

-
-

aircraft.overlay_update._loop_ ( )

-
-

aircraft.steering

-
steering

-
Class that implements differential braking depending on rudder position.

-
Note that this overrides the controls.applyBrakes() wrapper. If you need

-
your own version, then override it again after the steering.init() call.

-
SYNOPSIS:

-
steering.init([<property> [, <threshold>]]);

-
<property> ... property path or props.Node hash that enables/disables

-
brake steering (usually bound to the js trigger button)

-
<threshold> ... defines range (+- threshold) around neutral rudder

-
position in which both brakes are applied

-
EXAMPLES:

-
aircraft.steering.init("/controls/gear/steering", 0.2);

-
aircraft.steering.init();

-
-

aircraft.steering.init ( switch = )

-
-

aircraft.steering._loop_ ( id )

-
-

aircraft.steering.setbrakes ( left, right )

-
-

aircraft.autotrim

-
autotrim

-
Singleton class that supports quick trimming and compensates for the lack

-
of resistance/force feedback in most joysticks. Normally the pilot trims such

-
that no real or artificially generated (by means of servo motors and spring

-
preloading) forces act on the stick/yoke and it is in a comfortable position.

-
This doesn't work well on computer joysticks.

-
SYNOPSIS:

-
autotrim.start(); on key/button press

-
autotrim.stop(); on key/button release (mod-up)

-
USAGE:

-
(1) move the stick such that the aircraft is in an orientation that

-
you want to trim for (forward flight, hover, ...)

-
(2) press autotrim button and keep it pressed

-
(3) move stick/yoke to neutral position (center)

-
(4) release autotrim button

-
-

aircraft.autotrim.init ( )

-
-

aircraft.autotrim.start ( )

-
-

aircraft.autotrim.stop ( )

-
-

aircraft.autotrim._loop_ ( id )

-
-

aircraft.autotrim.update ( )

-
-

aircraft.autotrim.new ( name )

-
-

aircraft.autotrim.start ( )

-
-

aircraft.autotrim.update ( )

-
-

aircraft.tyresmoke

-
-

aircraft.tyresmoke.new ( number, auto = 0, diff_norm = 0.05, check_vspeed=1 )

-
-

aircraft.tyresmoke.del ( )

-
-

aircraft.tyresmoke.update ( )

-
-

aircraft.tyresmoke._wowchanged_ ( )

-
-

aircraft.tyresmoke_system

-
-

aircraft.tyresmoke_system.new ( )

-
-

aircraft.tyresmoke_system.del ( )

-
-

aircraft.rain

-
rain

-
Provides a property which can be used to control rain. Can be used to turn

-
off rain in internal views, and or used with a texture on canopies etc.

-
The output is co-ordinated with system precipitation:

-
/sim/model/rain/raining-norm rain intensity

-
/sim/model/rain/flow-mps drop flow speed [m/s]

-
See Hawker Seahawk for an example.

-
SYNOPSIS:

-
aircraft.rain.init();

-
aircraft.rain.update();

-
-

aircraft.rain.init ( )

-
-

aircraft.rain.update ( )

-
-

aircraft.teleport ( airport = speed = 0, distance = 0, azimuth = 0, glideslope = 0, heading = 9999 )

-
teleport

-
Usage: aircraft.teleport(lat:48.3, lon:32.4, alt:5000);

-
-

aircraft.wind_speed_from ( azimuth )

-
returns wind speed [kt] from given direction [deg]; useful for head-wind

-
-

aircraft.kias_to_ktas ( kias, altitude )

-
returns true airspeed for given indicated airspeed [kt] and altitude [m]

-
-

aircraft.HUD

-
HUD control class to handle both HUD implementations

-
-

aircraft.HUD.init ( )

-
-

aircraft.HUD.cycle_color ( )

-
-

aircraft.HUD.cycle_brightness ( )

-
-

aircraft.HUD.normal_type ( )

-
-

aircraft.HUD.cycle_type ( )

-
-

aircraft.HUD.is_active ( )

-
-

aircraft.crossfeed_valve

-
crossfeed_valve

-
class that creates a fuel tank cross-feed valve. Designed for YASim aircraft;

-
JSBSim aircraft can simply use systems code within the FDM (see 747-400 for

-
an example).

-
WARNING: this class requires the tank properties to be ready, so call new()

-
after the FDM is initialized.

-
SYNOPSIS:

-
crossfeed_valve.new(<max_flow_rate>, <property>, <tank>, <tank>, ... );

-
crossfeed_valve.open(<update>);

-
crossfeed_valve.close(<update>);

-
<max_flow_rate> ... maximum transfer rate between the tanks in lbs/sec

-
<property> ... property path to use as switch - pass nil to use no such switch

-
<tank> ... number of a tank to connect - can have unlimited number of tanks connected

-
<update> ... update switch property when opening/closing valve via Nasal - 0 or 1; by default, 1

-
EXAMPLES:

-
aircraft.crossfeed_valve.new(0.5, "/controls/fuel/x-feed", 0, 1, 2);

-
-------

-
var xfeed = aircraft.crossfeed_valve.new(1, nil, 0, 1);

-
xfeed.open();

-
-

aircraft.crossfeed_valve.new ( flow_rate, path )

-
-

aircraft.crossfeed_valve.open ( update_prop = 1 )

-
-

aircraft.crossfeed_valve.close ( update_prop = 1 )

-
-

aircraft.crossfeed_valve._loop_ ( id )

-
-
-

aurora

-

aurora.aurora_manager

-
-

aurora.aurora_manager.init ( )

-
-

aurora.aurora_manager.state ( )

-
-

aurora.aurora_manager.start ( )

-
-

aurora.aurora_manager.stop ( )

-
-

aurora.aurora_manager.update ( )

-
-

aurora.aurora_manager.evolve ( )

-
-
-

bits

-

bits.test ( n, b )

-
checks whether bit <b> is set in number <n>

-
-

bits.set ( n, b )

-
returns number <n> with bit <b> set

-
-

bits.clear ( n, b )

-
returns number <n> with bit <b> cleared

-
-

bits.toggle ( n, b )

-
returns number <n> with bit <b> toggled

-
-

bits.switch ( n, b, v )

-
returns number <n> with bit <b> set to value <v>

-
-

bits.string ( n, len = 1 )

-
returns number <n> as bit string, zero-padded to <len> digits:

-
bits.string(6) -> "110"

-
bits.string(6, 8) -> "00000110"

-
-

bits.value ( s )

-
returns bit string <s> as number: bits.value("110") -> 6

-
-
-

checklist

-

checklist.convert_checklists ( )

-
Convert checklists into full tutorials.

-
-
-

contrail

-
-

controls

-

controls.startEngine ( v = 1, which... )

-
-

controls.selectEngine ( which )

-
-

controls.selectEngines ( state, which... )

-
Selects (state=1) or deselects (state=0) a list of engines, or all

-
engines if no list is specified. Example: selectEngines(1, 1, 3, 5);

-
-

controls.selectAllEngines ( )

-
-

controls.stepMagnetos ( change )

-
-

controls.centerFlightControls ( )

-
-

controls.throttleMouse ( )

-
-

controls.axisHandler ( pre, post )

-
Joystick axis handlers (use cmdarg). Shouldn't be called from

-
other contexts. A non-null argument reverses the axis direction.

-
-

controls.perIndexAxisHandler ( pre, post )

-
Joystick axis handler for controlling subsets of similar properties.

-
Shouldn't be called from other contexts.

-
The argument engine can be either an index number or a list of

-
index numbers.

-
Use only when perEngineSelectedAxisHandler() below will not do.

-
-

controls._axisMode

-
Joystick axis handler for controlling a selected axis on specific engines.

-
Shouldn't be called from other contexts.

-
The argument mode can be

-
0 - throttle

-
1 - mixture

-
2 - propeller-pitch

-
The argument engine to the returned function can be either an

-
engine number or a list of engine numbers.

-
Usage example (controlling the mixture of engines 0 and 1):

-
<script>

-
controls.perEngineSelectedAxisHandler(1)([0,1]);

-
</script>

-
-

controls.perEngineSelectedAxisHandler ( mode )

-
-

controls.flapsDown ( step )

-
Wrapper around stepProps() which emulates the "old" flap behavior for

-
configurations that aren't using the new mechanism.

-
-

controls.wingSweep ( step )

-
-

controls.wingsDown ( v )

-
-

controls.stepSpoilers ( step )

-
-

controls.stepSlats ( step )

-
-

controls.stepProps ( dst, array, delta )

-
Steps through an "array" of property settings. The first argument

-
specifies a destination property. The second is a string containing

-
a global property tree. This tree should contain an array of

-
indexed <setting> children. This function will maintain a

-
<current-setting> child, which contains the index of the currently

-
active setting. The third argument specifies an integer delta,

-
indicating how many steps to move through the setting array.

-
Note that because of the magic of the property system, this

-
mechanism works for all scalar property types (bool, int, double,

-
string).

-
TODO: This interface could easily be extended to allow for wrapping,

-
in addition to clamping, allowing a "cycle" of settings to be

-
defined. It could also be hooked up with the interpolate() call,

-
which would allow the removal of the transition-time feature from

-
YASim. Finally, other pre-existing features (the views and engine

-
magnetos, for instance), work similarly but not compatibly, and

-
could be integrated.

-
-

controls.slewProp ( prop, delta )

-
"Slews" a property smoothly, without dependence on the simulator

-
frame rate. The first argument is the property name. The second is

-
a rate, in units per second. NOTE: this modifies the property for

-
the current frame only; it is intended to be called by bindings

-
which repeat each frame. If you want to cause motion over time, see

-
interpolate(). Returns new value.

-
-

controls.elevatorTrim ( speed )

-
Handlers. These are suitable for binding to repeatable button press

-
events. They are *not* good for binding to the keyboard, since (at

-
least) X11 synthesizes its own key repeats.

-
-

controls.aileronTrim ( speed )

-
-

controls.rudderTrim ( speed )

-
-

controls.adjThrottle ( speed )

-
-

controls.adjMixture ( speed )

-
-

controls.adjCondition ( speed )

-
-

controls.adjPropeller ( speed )

-
-

controls.adjEngControl ( prop, speed )

-
-

controls.incThrottle ( )

-
arg[0] is the throttle increment

-
arg[1] is the auto-throttle target speed increment

-
-

controls.incAileron ( )

-
arg[0] is the aileron increment

-
arg[1] is the autopilot target heading increment

-
-

controls.incElevator ( )

-
arg[0] is the elevator increment

-
arg[1] is the autopilot target altitude increment

-
-

controls.elevatorTrimAxis ( )

-
Joystick axis handlers. Don't call from other contexts.

-
-

controls.aileronTrimAxis ( )

-
-

controls.rudderTrimAxis ( )

-
-

controls.gearTogglePosition ( v )

-
to avoid clash with "gearToggle"; this will only toggle when

-
given a parameter of 1; as the controls button binding will pass 0 when the button is pressed and

-
1 when the button is released.

-
-

controls.gearDown ( v )

-
Gear handling.

-
- parameter v is either 1 (down), -1 up (retracted)

-
-

controls.gearToggle ( )

-
-

controls.applyBrakes ( v, which = 0 )

-
-

controls.applyPickle ( v )

-
-

controls.applyParkingBrake ( v )

-
-

controls.parkingBrakeToggle ( v )

-
-

controls.toggleNWS ( v )

-
-

controls.applyApplicableBrakes ( v, which = 0 )

-
allows one binding to do airbrakes and wheel brakes

-
-

controls.deployChute ( v )

-
1: Deploy, -1: Release

-
-

controls.trigger ( b )

-
Weapon handling.

-
-

controls.weaponSelect ( d )

-
-

controls.ptt ( b )

-
Communication.

-
-

controls.toggleLights ( )

-
Lighting.

-
-

controls.replaySkip ( skip_time )

-
-

controls.speedup ( speed_up )

-
-

controls.cycleMouseMode ( node )

-
-
-

debug

-

debug._title ( s, color=nil )

-
ANSI color code wrappers (see $ man console_codes)

-
-

debug._section ( s, color=nil )

-
-

debug._error ( s, color=nil )

-
-

debug._bench ( s, color=nil )

-
-

debug._nil ( s, color=nil )

-
-

debug._string ( s, color=nil )

-
-

debug._num ( s, color=nil )

-
-

debug._bracket ( s, color=nil )

-
-

debug._brace ( s, color=nil )

-
-

debug._angle ( s, color=nil )

-
-

debug._vartype ( s, color=nil )

-
-

debug._proptype ( s, color=nil )

-
-

debug._path ( s, color=nil )

-
-

debug._internal ( s, color=nil )

-
-

debug._varname ( s, color=nil )

-
-

debug.propify ( p, create = 0 )

-
Turn p into props.Node (if it isn't yet), or return nil.

-
-

debug.tree ( n = )

-
-

debug._tree ( n, graph = 1, prefix = )

-
-

debug.attributes ( p, verbose = 1, color=nil )

-
-

debug._dump_prop ( p, color=nil )

-
-

debug._dump_var ( v, color=nil )

-
-

debug._dump_string ( str, color=nil )

-
-

debug._dump_key ( s, color=nil )

-
dump hash keys as variables if they are valid variable names, or as string otherwise

-
-

debug.string ( o, color=nil )

-
-

debug.dump ( vars... )

-
-

debug.local ( frame = 0 )

-
-

debug.backtrace ( desc = nil, dump_vars = 1, skip_level = 0 )

-
-

debug.proptrace ( root = )

-
-

debug.benchmark ( label, fn, repeat = nil, output=nil )

-
Executes function fn "repeat" times and prints execution time in seconds. If repeat

-
is an integer and an optional "output" argument is specified, each test's result

-
is appended to that vector, then the vector is returned. If repeat is nil, then

-
the funciton is run once and the result returned. Otherwise, the result is discarded.

-
Examples:

-
var test = func { getprop("/sim/aircraft"); }

-
debug.benchmark("test()/1", test, 1000);

-
debug.benchmark("test()/2", func setprop("/sim/aircraft", ""), 1000);

-
var results = debug.benchmark("test()", test, 1000, []);

-
print(" Results were:");

-
print(" ", debug.string(results));

-
-

debug.benchmark_time ( fn, repeat = 1, output = nil )

-
-

debug.rank ( list, repeat = nil )

-
Executes each function in the list and returns a sorted vector with the fastest

-
on top (i.e. first). Each position in the result is a vector of [func, time].

-
-

debug.print_rank ( label, list, names )

-
-

debug.printerror ( err )

-
print error vector as set by call(). By using call() one can execute

-
code that catches "exceptions" (by a die() call or errors). The Nasal

-
code doesn't abort in this case. Example:

-
var possibly_buggy = func { ... }

-
call(possibly_buggy, nil, var err = []);

-
debug.printerror(err);

-
-

debug.warn ( msg, level = 0 )

-
like die(), but code execution continues. The level argument defines

-
how many caller() levels to omit. One is automatically omitted, as

-
this would only point to debug.warn(), where the event in question

-
didn't happen.

-
-

debug.isnan ( )

-
-

debug.Probe

-
Probe class - collect statistics; controlled via property tree

-
Data can be viewed / modified in the prop tree /_debug/nas/probe-<myLabel>/*

-
./enable bool,

-
./reset bool, reset hit counters to 0 and _start_time to now

-
./hits[i] number of hits, by default i=0 -> hits

-
secondary counters can be added under the same path

-
with addCounter()

-
./time after generateStats() show how long the probe was enabled

-
./hps after generateStats() show avg. hits/second

-
./hitratio after generateStats() if two counters: hits[1]/hits[0]

-
== Example ==

-
var myProbe = debug.Probe.new("myLabel").enable();

-
var cnt2 = myProbe.addCounter(); create a 2nd counter

-
at the place of interest (e.g. in some loop or class method) insert:

-
myProbe.hit(); count how often this place in the code is hit

-
if (condition)

-
myProbe.hit(cnt2); count how often condition is true

-
print(myProbe.getHits());

-
print(myProbe.getHits(cnt2)/myProbe.getHits()); print hit ratio

-
-

debug.Probe.new ( label, class = )

-
label: Used in property path

-
prefix: Optional

-
-

debug.Probe.reset ( )

-
-

debug.Probe.setTimeout ( seconds )

-
set timeout, next hit() after timeout will disable()

-
-

debug.Probe.enable ( )

-
enable counting

-
-

debug.Probe.disable ( )

-
disable counting, write time and hit/s to property tree

-
-

debug.Probe.generateStats ( )

-
-

debug.Probe.getHits ( counter_id = 0 )

-
-

debug.Probe.addCounter ( )

-
add secondary counter(s)

-
returns counter id

-
-

debug.Probe.hit ( counter_id = 0, callback = nil )

-
increase counter (if enabled)

-
use addCounter() before using counter_id > 0

-
-

debug.Breakpoint

-
Breakpoint (BP) - do conditional backtrace (BT) controlled via property tree

-
* count how often the BP was hit

-
* do only a limited number of BT, avoid flooding the log / console

-
Data can be viewed / modified in the prop tree /_debug/nas/bp-<myLabel>/*

-
* tokens: number of backtraces to do; each hit will decrease this by 1

-
* hits: total number of hits

-
== Example ==

-
var myBP = debug.Breakpoint.new("myLabel", 0);

-
myBP.enable(4); allow 4 hits, then be quiet

-
at the place of interest (e.g. in some loop or class method) insert:

-
myBP.hit(); do backtrace here if tokens > 0, reduce tokens by 1

-
myBP.hit(myFunction); same but call myFunction instead of backtrace

-
print(myBP.getHits()); print total number of hits

-
-

debug.Breakpoint.new ( label, dump_locals = 1 )

-
label: Used in property path and as text for backtrace.

-
dump_locals: bool passed to backtrace. Dump variables in BT.

-
-

debug.Breakpoint.enable ( tokens = 1 )

-
enable BP and set hit limit;

-
tokens: int > 0; default: 1 (single shot); 0 allowed (=disable);

-
-

debug.Breakpoint.hit ( callback = nil )

-
hit the breakpoint, e.g. do backtrace if we have tokens available

-
-
-

dynamic_view

-

dynamic_view.sin ( a )

-
-

dynamic_view.cos ( a )

-
-

dynamic_view.sigmoid ( x )

-
-

dynamic_view.nsigmoid ( x )

-
-

dynamic_view.pow ( v, w )

-
-

dynamic_view.npow ( v, w )

-
-

dynamic_view.clamp ( v, min, max )

-
-

dynamic_view.normatan ( x )

-
-

dynamic_view.normdeg ( a )

-
-

dynamic_view.Input

-
Class that reads a property value, applies factor & offset, clamps to min & max,

-
and optionally lowpass filters.

-
-

dynamic_view.Input.new ( prop = )

-
-

dynamic_view.Input.get ( )

-
-

dynamic_view.Input.set ( v )

-
-

dynamic_view.ViewAxis

-
Class that maintains one sim/current-view/goal-*-offset-deg property.

-
-

dynamic_view.ViewAxis.new ( prop )

-
-

dynamic_view.ViewAxis.reset ( )

-
-

dynamic_view.ViewAxis.add_offset ( )

-
-

dynamic_view.ViewAxis.sub_offset ( )

-
-

dynamic_view.ViewAxis.apply ( v )

-
-

dynamic_view.ViewAxis.static ( v )

-
-

dynamic_view.view_manager

-
Singleton class that manages a dynamic cockpit view by manipulating

-
sim/current-view/goal-*-offset-deg properties.

-
-

dynamic_view.view_manager.init ( )

-
-

dynamic_view.view_manager.reset ( )

-
-

dynamic_view.view_manager.add_offset ( )

-
-

dynamic_view.view_manager.apply ( )

-
-

dynamic_view.view_manager.lookat ( heading, pitch, roll, x, y, z, time, fov )

-
-

dynamic_view.view_manager.resume ( )

-
-

dynamic_view.view_manager.freeze ( )

-
-

dynamic_view.view_manager.unfreeze ( )

-
-

dynamic_view.view_manager.default_plane ( )

-
default calculations for a plane

-
-

dynamic_view.view_manager.default_helicopter ( )

-
default calculations for a helicopter

-
-

dynamic_view.main_loop ( id )

-
Update loop for the whole dynamic view manager. It only runs if

-
/sim/current-view/dynamic-view is true.

-
-

dynamic_view.freeze ( )

-
-

dynamic_view.register ( f )

-
-

dynamic_view.reset ( )

-
-

dynamic_view.lookat ( )

-
-

dynamic_view.resume ( )

-
-
-

earthview

-

earthview.check_lightning_table ( lat, lon )

-
-

earthview.start ( )

-
-

earthview.stop ( )

-
-

earthview.place_earth_model ( path, lat, lon, alt, heading, pitch, roll )

-
-

earthview.control_loop ( )

-
-

earthview.slow_loop ( )

-
-

earthview.lightning_strike ( )

-
-

earthview.adjust_cloud_tiles ( )

-
-

earthview.clear_cloud_tiles ( )

-
-

earthview.load_sector ( i, n )

-
-

earthview.earth_model

-
-

earthview.cloudsphere_model

-
-

earthview.aurora_model

-
-

earthview.center_N1

-
-

earthview.center_N2

-
-

earthview.center_N3

-
-

earthview.center_N4

-
-

earthview.center_S1

-
-

earthview.center_S2

-
-

earthview.center_S3

-
-

earthview.center_S4

-
-
-

emesary

-
-

emesary_mp_bridge

-
-

environment

-

environment.increaseVisibility ( )

-
Handler. Increase visibility by one step

-
-

environment.decreaseVisibility ( )

-
Handler. Decrease visibility by one step

-
-

environment.adjustVisibility ( factor )

-
-

environment.resetVisibility ( )

-
Handler. Reset visibility to default.

-
-
-

events

-

events.LogBuffer

-
-

events.LogBuffer.new ( max_messages = 128, echo = 0 )

-
Stores messages in a circular buffer that then can be retrieved at any point.

-
Messages are time stamped when pushed into the buffer, and the time stamp is

-
-

events.LogBuffer.push ( message )

-
-

events.LogBuffer.clear ( )

-
-

events.LogBuffer.get_buffer ( )

-
-
-

fuel

-

fuel.update ( )

-
-

fuel.loop ( )

-
-
-

geo

-

geo.floor ( v )

-
-

geo.Coord

-
class that maintains one set of geographical coordinates

-
-

geo.Coord.new ( copy = nil )

-
-

geo.Coord._cupdate ( )

-
-

geo.Coord._pupdate ( )

-
-

geo.Coord.x ( )

-
-

geo.Coord.y ( )

-
-

geo.Coord.z ( )

-
-

geo.Coord.xyz ( )

-
-

geo.Coord.lat ( )

-
-

geo.Coord.lon ( )

-
-

geo.Coord.alt ( )

-
-

geo.Coord.latlon ( )

-
-

geo.Coord.set_x ( x )

-
-

geo.Coord.set_y ( y )

-
-

geo.Coord.set_z ( z )

-
-

geo.Coord.set_lat ( lat )

-
-

geo.Coord.set_lon ( lon )

-
-

geo.Coord.set_alt ( alt )

-
-

geo.Coord.set ( c )

-
-

geo.Coord.set_latlon ( lat, lon, alt = 0 )

-
-

geo.Coord.set_xyz ( x, y, z )

-
-

geo.Coord.apply_course_distance ( course, dist )

-
-

geo.Coord.course_to ( dest )

-
-

geo.Coord.distance_to ( dest )

-
arc distance on an earth sphere; doesn't consider altitude

-
-

geo.Coord.direct_distance_to ( dest )

-
-

geo.Coord.is_defined ( )

-
-

geo.Coord.dump ( )

-
-

geo.normdeg ( angle )

-
normalize degree to 0 <= angle < 360

-
-

geo.normdeg180 ( angle )

-
normalize degree to -180 < angle <= 180

-
-

geo.tile_index ( lat, lon )

-
-

geo.format ( lat, lon )

-
-

geo.tile_path ( lat, lon )

-
-

geo.put_model ( path, c, arg... )

-
-

geo._put_model ( path, lat, lon, elev_m = nil, hdg = 0, pitch = 0, roll = 0 )

-
-

geo.elevation ( lat, lon, maxalt = 10000 )

-
-

geo.click_position ( )

-
-

geo.aircraft_position ( )

-
-

geo.viewer_position ( )

-
-

geo.PositionedSearch

-
A object to handle differential positioned searches:

-
searchCmd executes and returns the actual search,

-
onAdded and onRemoved are callbacks,

-
and obj is a "me" reference (defaults to "me" in the

-
caller's namespace). If searchCmd returns nil, nothing

-
happens, i.e. the diff is cancelled.

-
-

geo.PositionedSearch.new ( searchCmd, onAdded, onRemoved, obj=nil )

-
-

geo.PositionedSearch._equals ( a,b )

-
-

geo.PositionedSearch.condense ( vec )

-
-

geo.PositionedSearch.diff ( old, new )

-
-

geo.PositionedSearch.update ( searchCmd=nil )

-
-

geo.PositionedSearch.test ( from=640, to=320 )

-
this is the worst case scenario: switching from 640 to 320 (or vice versa)

-
-
-

glide_slope_tunnel

-

glide_slope_tunnel.normdeg ( a )

-
-

glide_slope_tunnel.best_runway ( apt )

-
Find best runway for current wind direction (or 270), also considering length and width.

-
-

glide_slope_tunnel.draw_tunnel ( rwy )

-
Draw 3 degree glide slope tunnel.

-
-

glide_slope_tunnel.loop ( id )

-
-
-

globals

-

globals.__

-
container for local variables, so as not to clutter the global namespace

-
-

globals.assert ( condition, message=nil )

-
Aborts execution if <condition> evaluates to false.

-
Prints an optional message if present, or just "assertion failed!"

-
-

globals.isa ( obj, class )

-
Returns true if the first object is an instance of the second

-
(class) object. Example: isa(someObject, props.Node)

-
-

globals.fgcommand ( cmd, node=nil )

-
Invokes a FlightGear command specified by the first argument. The

-
second argument specifies the property tree to be passed to the

-
command as its argument. It may be either a props.Node object or a

-
string, in which case it specifies a path in the global property

-
tree.

-
-

globals.cmdarg ( )

-
Returns the SGPropertyNode argument to the currently executing

-
function. Wrapper for the internal _cmdarg function that retrieves

-
the ghost handle to the argument and wraps it in a

-
props.Node object.

-
-

globals.abs ( v )

-
Utility. Does what you think it does.

-
-

globals.interpolate ( node, val... )

-
Convenience wrapper for the _interpolate function. Takes a

-
single string or props.Node object in arg[0] indicating a target

-
property, and a variable-length list of time/value pairs. Example:

-
interpolate("/animations/radar/angle",

-
180, 1, 360, 1, 0, 0,

-
180, 1, 360, 1, 0, 0,

-
180, 1, 360, 1, 0, 0,

-
180, 1, 360, 1, 0, 0,

-
180, 1, 360, 1, 0, 0,

-
180, 1, 360, 1, 0, 0,

-
180, 1, 360, 1, 0, 0,

-
180, 1, 360, 1, 0, 0);

-
This will swing the "radar dish" smoothly through 8 revolutions over

-
16 seconds. Note the use of zero-time interpolation between 360 and

-
0 to wrap the interpolated value properly.

-
-

globals.setlistener ( node, fn, init = 0, runtime = 1 )

-
Wrapper for the _setlistener function. Takes a property path string

-
or props.Node object in arg[0] indicating the listened to property,

-
a function in arg[1], an optional bool in arg[2], which triggers the

-
function initially if true, and an optional integer in arg[3], which

-
sets the listener's runtime behavior to "only trigger on change" (0),

-
"always trigger on write" (1), and "trigger even when children are

-
written to" (2).

-
-

globals.defined ( sym )

-
Returns true if the symbol name is defined in the caller, or the

-
caller's lexical namespace. (i.e. defined("varname") tells you if

-
you can use varname in an expression without a undefined symbol

-
error.

-
-

globals.thisfunc ( caller )

-
Returns reference to calling function. This allows a function to

-
reliably call itself from a closure, rather than the global function

-
with the same name.

-
-

globals.printf ( print )

-
Just what it says it is.

-
-

globals.values ( hash )

-
Returns vector of hash values.

-
-

globals.printlog ( level )

-
-
-

gui

-

gui.popupTip ( label, delay = nil, override = nil, position = nil )

-
Pop up a "tip" dialog for a moment, then remove it. The delay in

-
seconds can be specified as the second argument. The default is 4

-
seconds. The third argument can be a hash with override values.

-
Note that the tip dialog is a shared resource. If someone else

-
comes along and wants to pop a tip up before your delay is finished,

-
you lose. :)

-
-

gui.showDialog ( name )

-
-

gui.menuEnable ( searchname, state )

-
Enable/disable named menu entry

-
-

gui.menuBind ( searchname, command )

-
Set the binding for a menu item to a Nasal script,

-
typically a dialog open() command.

-
-

gui.setCursor ( x = nil, y = nil, cursor = nil )

-
Set mouse cursor coordinates and shape (number or name), and return

-
current shape (number).

-
Example: var cursor = gui.setCursor();

-
gui.setCursor(nil, nil, "wait");

-
-

gui.findElementByName ( dialog,name )

-
Find a GUI element by given name.

-
dialog: dialog root property.

-
name: name of GUI element to be searched.

-
Returns GUI element when found, nil otherwise.

-
-

gui.fpsDisplay ( n )

-
Show/hide the fps display dialog.

-
-

gui.latencyDisplay ( n )

-
-

gui.popdown ( )

-
Pop down the tip dialog, if it is visible.

-
-

gui.Widget

-
A "widget" class that wraps a property node. It provides useful

-
helper methods that are difficult or tedious with the raw property

-
API. Note especially the slightly tricky addChild() method.

-
-

gui.Widget.set ( name, val )

-
-

gui.Widget.prop ( )

-
-

gui.Widget.new ( )

-
-

gui.Widget.addChild ( type )

-
-

gui.Widget.setColor ( r, g, b, a = 1 )

-
-

gui.Widget.setFont ( n, s = 13, t = 0 )

-
-

gui.Widget.setBinding ( cmd, carg = nil )

-
-

gui.Dialog

-
Dialog class. Maintains one XML dialog.

-
SYNOPSIS:

-
(B) Dialog.new(<dialog-name>); ... use dialog from $FG_ROOT/gui/dialogs/

-
(A) Dialog.new(<prop>, <path> [, <dialog-name>]);

-
... load aircraft specific dialog from

-
<path> under property <prop> and under

-
name <dialog-name>; if no name is given,

-
then it's taken from the XML dialog

-
prop ... target node (name must be "dialog")

-
path ... file path relative to $FG_ROOT

-
dialog-name ... dialog <name> of dialog in $FG_ROOT/gui/dialogs/

-
EXAMPLES:

-
var dlg = gui.Dialog.new("/sim/gui/dialogs/foo-config/dialog",

-
"Aircraft/foo/foo_config.xml");

-
dlg.open();

-
dlg.close();

-
var livery_dialog = gui.Dialog.new("livery-select");

-
livery_dialog.toggle();

-
-

gui.Dialog.new ( prop, path = nil, name = nil )

-
-

gui.Dialog.del ( )

-
-

gui.Dialog.load ( )

-
doesn't need to be called explicitly, but can be used to force a reload

-
-

gui.Dialog.namespace ( )

-
allows access to dialog-embedded Nasal variables/functions

-
-

gui.Dialog.open ( )

-
-

gui.Dialog.close ( )

-
-

gui.Dialog.toggle ( )

-
-

gui.Dialog.is_open ( )

-
-

gui.OverlaySelector

-
Overlay selector. Displays a list of overlay XML files and copies the

-
chosen one to the property tree. The class allows to select liveries,

-
insignia, decals, variants, etc. Usually the overlay properties are

-
fed to "select" and "material" animations.

-
SYNOPSIS:

-
OverlaySelector.new(<title>, <dir>, <nameprop> [, <sortprop> [, <mpprop> [, <callback>]]]);

-
title ... dialog title

-
dir ... directory where to find the XML overlay files,

-
relative to FG_ROOT

-
nameprop ... property in an overlay file that contains the name

-
The result is written to this place in the

-
property tree.

-
sortprop ... property in an overlay file that should be used

-
as sorting criterion, if alphabetic sorting by

-
name is undesirable. Use nil if you don't need

-
this, but want to set a callback function.

-
mpprop ... property path of MP node where the file name should

-
be written to

-
callback ... function that's called after a new entry was chosen,

-
with these arguments:

-
callback(<number>, <name>, <sort-criterion>, <file>, <path>)

-
EXAMPLE:

-
aircraft.data.add("sim/model/pilot"); autosave the pilot

-
var pilots_dialog = gui.OverlaySelector.new("Pilots",

-
"Aircraft/foo/Models/Pilots",

-
"sim/model/pilot");

-
pilots_dialog.open(); or ... close(), or toggle()

-
-

gui.OverlaySelector.new ( title, dir, nameprop, sortprop = nil, mpprop = nil, callback = nil )

-
-

gui.OverlaySelector.reinit ( )

-
-

gui.OverlaySelector.del ( )

-
-

gui.OverlaySelector.rescan ( )

-
-

gui.OverlaySelector.set ( index )

-
-

gui.OverlaySelector.select ( name )

-
-

gui.OverlaySelector.next ( )

-
-

gui.OverlaySelector.previous ( )

-
-

gui.FileSelector

-
FileSelector class (derived from Dialog class).

-
SYNOPSIS: FileSelector.new(<callback>, <title>, <button> [, <pattern> [, <dir> [, <file> [, <dotfiles>]]]])

-
callback ... callback function that gets return value as first argument

-
title ... dialog title

-
button ... button text (should say "Save", "Load", etc. and not just "OK")

-
pattern ... array with shell pattern or nil (which is equivalent to "*")

-
dir ... starting dir ($FG_ROOT if unset)

-
file ... pre-selected default file name

-
dotfiles ... flag that decides whether UNIX dotfiles should be shown (1) or not (0)

-
EXAMPLE:

-
var report = func(n) { print("file ", n.getValue(), " selected") }

-
var selector = gui.FileSelector.new(

-
report, callback function

-
"Save Flight", dialog title

-
"Save", button text

-
["*.sav", "*.xml"], pattern for displayed files

-
"/tmp", start dir

-
"flight.sav"); default file name

-
selector.open();

-
selector.close();

-
selector.set_title("Save Another Flight");

-
selector.open();

-
-

gui.FileSelector.new ( callback, title, button, pattern = nil, dir = )

-
-

gui.FileSelector.set_title ( title )

-
setters only take effect after the next call to open()

-
-

gui.FileSelector.set_button ( button )

-
-

gui.FileSelector.set_directory ( dir )

-
-

gui.FileSelector.set_file ( file )

-
-

gui.FileSelector.set_dotfiles ( dot )

-
-

gui.FileSelector.set_pattern ( pattern )

-
-

gui.FileSelector.open ( )

-
-

gui.FileSelector.close ( )

-
-

gui.FileSelector.del ( )

-
-

gui.DirSelector

-
DirSelector - convenience "class" (indeed using a reconfigured FileSelector)

-
-

gui.DirSelector.new ( callback, title, button, dir = )

-
-

gui.save_flight ( )

-
-

gui.load_flight ( )

-
-

gui.set_screenshotdir ( )

-
-

gui.property_browser ( dir = nil )

-
Open property browser with given target path.

-
-

gui.dialog_apply ( dialog, objects... )

-
Apply whole dialog or list of widgets. This copies the widgets'

-
visible contents to the respective <property>.

-
-

gui.dialog_update ( dialog, objects... )

-
Update whole dialog or list of widgets. This makes the widgets

-
adopt and display the value of their <property>.

-
-

gui.enable_widgets ( node, name, enable = 1 )

-
Searches a dialog tree for widgets with a particular <name> entry and

-
sets their <enabled> flag.

-
-

gui.nextStyle ( )

-
-

gui.dialog

-
-

gui.setWeight ( wgt, opt )

-
-

gui.setWeightOpts ( )

-
Checks the /sim/weight[n]/{selected|opt} values and sets the

-
appropriate weights therefrom.

-
-

gui.weightChangeHandler ( )

-
Called from the F&W dialog when the user selects a weight option

-
-

gui.showWeightDialog ( )

-
-

gui.showHelpDialog ( path, toggle=0 )

-
Dynamically generates a dialog from a help node.

-
gui.showHelpDialog([<path> [, toggle]])

-
path ... path to help node

-
toggle ... decides if an already open dialog should be closed

-
(useful when calling the dialog from a key binding; default: 0)

-
help node

-
each of <title>, <key>, <line>, <text> is optional; uses

-
"/sim/description" or "/sim/aircraft" if <title> is omitted;

-
only the first <text> is displayed

-
<help>

-
<title>dialog title<title>

-
<key>

-
<name>g/G</name>

-
<desc>gear up/down</desc>

-
</key>

-
<line>one line</line>

-
<line>another line</line>

-
<text>text in

-
scrollable widget

-
</text>

-
</help>

-
-

gui.debug_keys

-
-

gui.basic_keys

-
-

gui.common_aircraft_keys

-
-

gui.update_shader_settings ( )

-
overwrite custom shader settings when quality-level is set through the slider

-
in the Rendering Options dialog

-
-
-

io

-

io.readfile ( file )

-
Reads and returns a complete file as a string

-
-

io.basename ( path )

-
-

io.dirname ( path )

-
-

io.include ( file )

-
-

io.load_nasal ( file, module = nil )

-
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.

-
Usage: io.load_nasal(<filename> [, <modulename>]);

-
Example:

-
io.load_nasal(getprop("/sim/fg-root") ~ "/Local/test.nas");

-
io.load_nasal("/tmp/foo.nas", "test");

-
-

io.read_properties ( path, target = nil )

-
Load XML file in FlightGear's native <PropertyList> format.

-
If the second, optional target parameter is set, then the properties

-
are loaded to this node in the global property tree. Otherwise they

-
are returned as a separate props.Node tree. Returns the data as a

-
props.Node on success or nil on error.

-
Usage: io.read_properties(<filename> [, <props.Node or property-path>]);

-
Examples:

-
var target = props.globals.getNode("/sim/model");

-
io.read_properties("/tmp/foo.xml", target);

-
var data = io.read_properties("/tmp/foo.xml", "/sim/model");

-
var data = io.read_properties("/tmp/foo.xml");

-
-

io.read_airport_properties ( icao, fname, target = nil )

-
Load XML file in FlightGear's native <PropertyList> format.

-
file will be located in the airport-scenery directories according to

-
ICAO and filename, i,e in Airports/I/C/A/ICAO.filename.xml

-
If the second, optional target parameter is set, then the properties

-
are loaded to this node in the global property tree. Otherwise they

-
are returned as a separate props.Node tree. Returns the data as a

-
props.Node on success or nil on error.

-
Usage: io.read_airport_properties(<icao>, <filename> [, <props.Node or property-path>]);

-
Examples:

-
var data = io.read_properties("KSFO", "rwyuse");

-
-

io.write_properties ( path, prop )

-
Write XML file in FlightGear's native <PropertyList> format.

-
Returns the filename on success or nil on error. If the source

-
is a props.Node that refers to a node in the main tree, then

-
the data are directly written from the tree, yielding a more

-
accurate result. Otherwise the data need to be copied first,

-
which may slightly change node types (FLOAT becomes DOUBLE etc.)

-
Usage: io.write_properties(<filename>, <props.Node or property-path>);

-
Examples:

-
var data = props.Node.new({ a:1, b:2, c:{ d:3, e:4 } });

-
io.write_properties("/tmp/foo.xml", data);

-
io.write_properties("/tmp/foo.xml", "/sim/model");

-
-

io.readxml ( path, prefix = )

-
Reads an XML file from an absolute path and returns it as property

-
tree. All nodes will be of type STRING. Data are only written to

-
leafs. Attributes are written as regular nodes with the optional

-
prefix prepended to the name. If the prefix is nil, then attributes

-
are ignored. Returns nil on error.

-
-

io.writexml ( path, node, indent = )

-
Writes a property tree as returned by readxml() to a file. Children

-
with name starting with <prefix> are again turned into attributes of

-
their parent. <node> must contain exactly one child, which will

-
become the XML file's outermost element.

-
-
-

joystick

-

joystick.custom_bindings

-
Hash of the custom axis/buttons

-
-

joystick.Axis

-
Class for an individual joystick axis binding

-
-

joystick.Axis.new ( name, prop, invertable )

-
-

joystick.Axis.clone ( )

-
-

joystick.Axis.match ( prop )

-
-

joystick.Axis.parse ( prop )

-
-

joystick.Axis.readProps ( props )

-
-

joystick.Axis.getName ( )

-
-

joystick.Axis.getBinding ( axis )

-
-

joystick.Axis.isInvertable ( )

-
-

joystick.Axis.isInverted ( )

-
-

joystick.Axis.setInverted ( b )

-
-

joystick.CustomAxis

-
-

joystick.CustomAxis.new ( )

-
-

joystick.CustomAxis.clone ( )

-
-

joystick.CustomAxis.match ( prop )

-
-

joystick.CustomAxis.getBinding ( axis )

-
-

joystick.UnboundAxis

-
-

joystick.UnboundAxis.new ( )

-
-

joystick.UnboundAxis.clone ( )

-
-

joystick.UnboundAxis.match ( prop )

-
-

joystick.UnboundAxis.getBinding ( axis )

-
-

joystick.PropertyScaleAxis

-
-

joystick.PropertyScaleAxis.new ( name, prop, factor=1, offset=0 )

-
-

joystick.PropertyScaleAxis.clone ( )

-
-

joystick.PropertyScaleAxis.match ( prop )

-
-

joystick.PropertyScaleAxis.parse ( p )

-
-

joystick.PropertyScaleAxis.getBinding ( axis )

-
-

joystick.NasalScaleAxis

-
-

joystick.NasalScaleAxis.new ( name, script, prop )

-
-

joystick.NasalScaleAxis.clone ( )

-
-

joystick.NasalScaleAxis.match ( prop )

-
-

joystick.NasalScaleAxis.getBinding ( axis )

-
-

joystick.NasalLowHighAxis

-
-

joystick.NasalLowHighAxis.new ( name, lowscript, highscript, prop, repeatable )

-
-

joystick.NasalLowHighAxis.clone ( )

-
-

joystick.NasalLowHighAxis.match ( prop )

-
-

joystick.NasalLowHighAxis.getBinding ( axis )

-
-

joystick.ButtonBinding

-
Button bindings

-
-

joystick.ButtonBinding.new ( name, binding, repeatable )

-
-

joystick.ButtonBinding.clone ( )

-
-

joystick.ButtonBinding.match ( prop )

-
-

joystick.ButtonBinding.getName ( )

-
-

joystick.ButtonBinding.getBinding ( button )

-
-

joystick.ButtonBinding.isRepeatable ( )

-
-

joystick.CustomButton

-
-

joystick.CustomButton.new ( )

-
-

joystick.CustomButton.clone ( )

-
-

joystick.CustomButton.match ( prop )

-
-

joystick.CustomButton.getBinding ( button )

-
-

joystick.UnboundButton

-
-

joystick.UnboundButton.new ( )

-
-

joystick.UnboundButton.clone ( )

-
-

joystick.UnboundButton.match ( prop )

-
-

joystick.UnboundButton.getBinding ( button )

-
-

joystick.PropertyToggleButton

-
-

joystick.PropertyToggleButton.new ( name, prop )

-
-

joystick.PropertyToggleButton.clone ( )

-
-

joystick.PropertyToggleButton.match ( prop )

-
-

joystick.PropertyToggleButton.getBinding ( button )

-
-

joystick.PropertyAdjustButton

-
-

joystick.PropertyAdjustButton.new ( name, prop, step )

-
-

joystick.PropertyAdjustButton.clone ( )

-
-

joystick.PropertyAdjustButton.match ( prop )

-
-

joystick.PropertyAdjustButton.getBinding ( button )

-
-

joystick.NasalButton

-
-

joystick.NasalButton.new ( name, script, repeatable )

-
-

joystick.NasalButton.clone ( )

-
-

joystick.NasalButton.match ( prop )

-
-

joystick.NasalButton.getBinding ( button )

-
-

joystick.NasalHoldButton

-
-

joystick.NasalHoldButton.new ( name, script, scriptUp )

-
-

joystick.NasalHoldButton.clone ( )

-
-

joystick.NasalHoldButton.match ( prop )

-
-

joystick.NasalHoldButton.getBinding ( button )

-
-

joystick.readConfig ( dialog_root= )

-
Parse config from the /input tree and write it to the

-
dialog_root.

-
-

joystick.writeConfig ( dialog_root= )

-
-

joystick.resetConfig ( dialog_root= )

-
-
-

lag_adjust

-

lag_adjust.mpCheck ( )

-
-

lag_adjust.mpInit ( )

-
-

lag_adjust.mpClean ( )

-
-

lag_adjust.mpStart ( )

-
-

lag_adjust.masterSwitch ( )

-
-
-

local_weather_auto_init

-

local_weather_auto_init.autoInit ( )

-
-
-

material

-

material.colorgroup ( parent, name, base )

-
-

material.mat ( parent, name, path, format, min=nil, max=nil )

-
-

material.showDialog ( base, title=nil, x=nil, y=nil )

-
-
-

math

-

math.abs ( n )

-
-

math.sgn ( x )

-
-

math.max ( x )

-
-

math.min ( x )

-
-

math.avg ( )

-
-

math.clamp ( value, min, max )

-
this follows std::clamp for argument order, as opposed to

-
qBound which uses (min, value, max)

-
-

math.mod ( n, m )

-
note - mathlib defines an fmod function (added after this was written)

-
It uses C-library fmod(), which has different rounding behaviour to

-
this code (eg, fmod(-5, 4) gives -1, whereas this code gives 3)

-
-

math.log10 ( x )

-
-
-

mp_broadcast

-

mp_broadcast.EventChannel

-
Event broadcast channel using a MP enabled string property.

-
Events from users in multiplayer.ignore are ignored.

-
EventChannel.new(mpp_path)

-
Create a new event broadcast channel. Any MP user with the same

-
primitive will receive all messages sent to the channel from the point

-
she/he joined (barring severe MP packet loss).

-
NOTE: Message delivery is not guaranteed.

-
mpp_path - MP property path : string

-
EventChannel.register(event_hash, handler)

-
Register a handler for the event identified by the hash event_hash.

-
event_hash - hash value for the event : a unique 4 character string

-
handler - a handler function for the event : func (sender, msg)

-
EventChannel.deregister(event_hash)

-
Deregister the handler for the event identified by the hash event_hash.

-
event_hash - hash value for the event : a unique 4 character string

-
EventChannel.send(event_hash, msg)

-
Sends the event event_hash with the message msg to the channel.

-
event_hash - hash value for the event : a unique 4 character string

-
msg - text string with Binary data encoded data : string

-
EventChannel.die()

-
Destroy this EventChannel instance.

-
-

mp_broadcast.EventChannel.new ( mpp_path )

-
-

mp_broadcast.EventChannel.register ( event_hash, - handler )

-
-

mp_broadcast.EventChannel.deregister ( event_hash )

-
-

mp_broadcast.EventChannel.send ( event_hash, - msg )

-
-

mp_broadcast.EventChannel._process ( n, msg )

-
Internals.

-
-

mp_broadcast.BroadcastChannel

-
Broadcast primitive using a MP enabled string property.

-
Broadcasts from users in multiplayer.ignore are ignored.

-
BroadcastChannel.new(mpp_path, process)

-
Create a new broadcast primitive. Any MP user with the same

-
primitive will receive all messages sent to the channel from the point

-
she/he joined (barring severe MP packet loss).

-
NOTE: Message delivery is not guaranteed.

-
mpp_path - MP property path : string

-
process - handler called when receiving a message : func (n, msg)

-
n is the base node of the senders property tree

-
(i.e. /ai/models/multiplay[x])

-
send_to_self - if 1 locally sent messages are : int {0,1}

-
delivered just like remote messages.

-
If 0 locally sent messages are not delivered

-
to the local receiver.

-
accept_predicate - function to select which : func (p)

-
multiplayers to listen to.

-
p is the multiplayer entry node.

-
The default is to accept any multiplayer.

-
on_disconnect - function to be called when an : func (p)

-
accepted MP user leaves.

-
enable_send - Set to 0 to disable sending.

-
BroadcastChannel.send(msg)

-
Sends the message msg to the channel.

-
msg - text string with Binary data encoded data : string

-
BroadcastChannel.die()

-
Destroy this BroadcastChannel instance.

-
-

mp_broadcast.BroadcastChannel.new ( mpp_path, process, - send_to_self = 0, accept_predicate = nil, on_disconnect = nil, enable_send=1 )

-
-

mp_broadcast.BroadcastChannel.send ( msg )

-
-

mp_broadcast.BroadcastChannel.die ( )

-
-

mp_broadcast.BroadcastChannel.start ( )

-
-

mp_broadcast.BroadcastChannel.stop ( )

-
-

mp_broadcast.BroadcastChannel.set_state ( )

-
-

mp_broadcast.BroadcastChannel.update ( )

-
-

mp_broadcast.BroadcastChannel._loop_ ( id )

-
-

mp_broadcast.LamportClock

-
Lamport clock. Useful for creating a total order for events or messages.

-
The users' callsigns are used to break ties.

-
LamportClock.new()

-
Creates a new lamport clock for this user.

-
LamportClock.merge(sender, sender_timestamp)

-
Merges the timestamp from the sender with the local clock.

-
sender : base node of the senders property tree

-
sender_timestamp : the timestamp received from the sender.

-
Returns 1 if the local clock was advanced; 0 otherwise.

-
LamportClock.advance()

-
Advances the local clock one tick.

-
LamportClock.timestamp()

-
Returns an encoded 4 character long timestamp from the local clock.

-
-

mp_broadcast.LamportClock.new ( )

-
LamportClock.new()

-
Creates a new lamport clock for this user.

-
-

mp_broadcast.LamportClock.merge ( sender, sender_timestamp )

-
-

mp_broadcast.LamportClock.advance ( )

-
-

mp_broadcast.LamportClock.timestamp ( )

-
-

mp_broadcast.Binary

-
Some routines for encoding/decoding values into/from a string.

-
NOTE: MP is picky about what it sends in a string propery.

-
Encode 7 bits as a printable 8 bit character.

-
-

mp_broadcast.Binary.encodeInt ( int )

-
-

mp_broadcast.Binary.decodeInt ( str )

-
-

mp_broadcast.Binary.encodeByte ( int )

-
-

mp_broadcast.Binary.decodeByte ( str )

-
-

mp_broadcast.Binary.encodeInt28 ( int )

-
-

mp_broadcast.Binary.decodeInt28 ( str )

-
-

mp_broadcast.Binary.encodeDouble ( d )

-
-

mp_broadcast.Binary.decodeDouble ( str )

-
-

mp_broadcast.Binary.encodeCoord ( coord )

-
-

mp_broadcast.Binary.decodeCoord ( str )

-
Decodes an encoded geo.Coord object.

-
-

mp_broadcast.Binary.stringHash ( str )

-
-

mp_broadcast.Binary.readHash ( str )

-
Decodes an encoded geo.Coord object.

-
-

mp_broadcast.MessageChannel

-
Detects incomming messages encoded in a string property.

-
n - MP source : property node

-
process - action : func (v)

-
NOTE: This is a low level component.

-
The same object is seldom used for both sending and receiving.

-
-

mp_broadcast.MessageChannel.new ( n = nil, process = nil )

-
-

mp_broadcast.MessageChannel.update ( )

-
-

mp_broadcast.MessageChannel.send ( msg )

-
-

mp_broadcast.MessageChannel.new_message_handler ( handler, arg1 )

-
-
-

multikey

-

multikey.start ( )

-
-

multikey.stop ( )

-
-

multikey.handle_key ( key )

-
-

multikey.Dialog

-
-

multikey.Dialog.new ( )

-
-

multikey.Dialog.del ( )

-
-

multikey.Dialog.update ( cmd, title, options )

-
-

multikey.help ( )

-
-

multikey.find_entry ( str, data, result )

-
-

multikey.init ( )

-
-
-

multiplayer

-

multiplayer.lastmsg

-
-

multiplayer.ignore

-
-

multiplayer.check_messages ( loop_id )

-
-

multiplayer.echo_message ( callsign, msg )

-
-

multiplayer.timeout_handler ( )

-
-

multiplayer.chat_listener ( n )

-
-

multiplayer.my_kbd_listener ( event )

-
-

multiplayer.capture_kbd ( )

-
-

multiplayer.release_kbd ( )

-
-

multiplayer.compose_message ( msg = )

-
-

multiplayer.end_compose_message ( )

-
-

multiplayer.handle_key ( key )

-
-

multiplayer.dialog

-
-

multiplayer.dialog.init ( x = nil, y = nil )

-
-

multiplayer.dialog.create ( )

-
-

multiplayer.dialog.update ( id )

-
-

multiplayer.dialog._redraw_ ( )

-
-

multiplayer.dialog.toggle_unit ( )

-
-

multiplayer.dialog.toggle_ignore ( callsign )

-
-

multiplayer.dialog.close ( )

-
-

multiplayer.dialog.del ( )

-
-

multiplayer.dialog.show ( )

-
-

multiplayer.dialog.toggle ( )

-
-

multiplayer.dialog.IDCode ( code )

-
-

multiplayer.model

-
Autonomous singleton class that monitors multiplayer aircraft,

-
maintains data in various structures, and raises signal

-
"/sim/signals/multiplayer-updated" whenever an aircraft

-
joined or left. Available data containers are:

-
multiplayer.model.data: hash, key := /ai/models/~ path

-
multiplayer.model.callsign hash, key := callsign

-
multiplayer.model.list vector, sorted alphabetically (ASCII, case insensitive)

-
All of them contain hash entries of this form:

-
{

-
callsign: "BiMaus",

-
path: "Aircraft/bo105/Models/bo105.xml", relative file path

-
root: "/ai/models/multiplayer[4]", root property

-
node: {...}, root property as props.Node hash

-
model: "bo105", model name (extracted from path)

-
sort: "bimaus", callsign in lower case (for sorting)

-
}

-
-

multiplayer.model.init ( )

-
-

multiplayer.model.update ( n = nil )

-
-

multiplayer.model.remove_suffix ( s, x )

-
-

multiplayer.mp_mode_changed ( n )

-
-
-

notifications

-
-

orbital_target

-

orbital_target.orbitalTarget

-
-

orbital_target.orbitalTarget.new ( altitude, inclination, node_longitude, anomaly )

-
-

orbital_target.orbitalTarget.set_anomaly ( anomaly )

-
-

orbital_target.orbitalTarget.set_delta_lon ( dl )

-
-

orbital_target.orbitalTarget.list ( )

-
-

orbital_target.orbitalTarget.evolve ( )

-
-

orbital_target.orbitalTarget.get_inertial_pos ( )

-
-

orbital_target.orbitalTarget.get_inertial_pos_at_time ( time )

-
-

orbital_target.orbitalTarget.get_inertial_speed ( )

-
-

orbital_target.orbitalTarget.get_inertial_speed_at_time ( time )

-
-

orbital_target.orbitalTarget.compute_inertial_pos ( anomaly_rad, nl_rad )

-
-

orbital_target.orbitalTarget.get_latlonalt ( )

-
-

orbital_target.orbitalTarget.start ( )

-
-

orbital_target.orbitalTarget.stop ( )

-
-

orbital_target.orbitalTarget.run ( )

-
-
-

prop_key_handler

-

prop_key_handler.start ( )

-
-

prop_key_handler.stop ( save_history = 0 )

-
-

prop_key_handler.handle_key ( key, shift )

-
-

prop_key_handler.parse_input ( expr )

-
-

prop_key_handler.build_completion ( in )

-
-

prop_key_handler.complete ( in, step )

-
-

prop_key_handler.set_history ( step )

-
-

prop_key_handler.set_color ( r, g, b )

-
-

prop_key_handler.print_prop ( n )

-
-

prop_key_handler.search ( n, s )

-
-
-

props

-

props.Node

-
Node class definition. The class methods simply wrap the

-
low level extension functions which work on a "ghost" handle to a

-
SGPropertyNode object stored in the _g field.

-
Not all of the features of SGPropertyNode are supported. There is

-
no support for ties, obviously, as that wouldn't make much sense

-
from a Nasal context. The various get/set methods work only on the

-
local node, there is no equivalent of the "relative path" variants

-
available in C++; just use node.getNode(path).whatever() instead.

-
-

props.Node.getNode ( wrap )

-
-

props.Node.getParent ( wrap )

-
-

props.Node.getChild ( wrap )

-
-

props.Node.getChildren ( wrap )

-
-

props.Node.setChildren ( wrap )

-
-

props.Node.addChild ( wrap )

-
-

props.Node.addChildren ( wrap )

-
-

props.Node.removeChild ( wrap )

-
-

props.Node.removeChildren ( wrap )

-
-

props.Node.removeAllChildren ( wrap )

-
-

props.Node.getAliasTarget ( wrap )

-
-

props.Node.getName ( _getName )

-
-

props.Node.getIndex ( _getIndex )

-
-

props.Node.getType ( _getType )

-
-

props.Node.getAttribute ( _getAttribute )

-
-

props.Node.setAttribute ( _setAttribute )

-
-

props.Node.getValue ( _getValue )

-
-

props.Node.setValue ( _setValue )

-
-

props.Node.setValues ( _setValues )

-
-

props.Node.setIntValue ( _setIntValue )

-
-

props.Node.setBoolValue ( _setBoolValue )

-
-

props.Node.setDoubleValue ( _setDoubleValue )

-
-

props.Node.unalias ( _unalias )

-
-

props.Node.alias ( n )

-
-

props.Node.equals ( n )

-
-

props.Node.clearValue ( _alias )

-
-

props.Node.getPath ( )

-
-

props.Node.getBoolValue ( )

-
-

props.Node.remove ( )

-
-

props.Node.resolveAlias ( p = nil )

-
follow alias links to "real" node (e.g. where the data is stored)

-
optional argument: property node or prop path to resolve

-
if no argument is given, operate on current obj ("me")

-
-

props.Node.new ( values = nil )

-
Static constructor for a Node object. Accepts a Nasal hash

-
expression to initialize the object a-la setValues().

-
-

props.Node.getValues ( )

-
Counter piece of setValues(). Returns a hash with all values

-
in the subtree. Nodes with same name are returned as vector,

-
where the original node indices are lost. The function should

-
only be used if all or almost all values are needed, and never

-
in performance-critical code paths. If it's called on a node

-
without children, then the result is equivalent to getValue().

-
-

props.Node.initNode ( path = nil, value = 0, type = nil, force = 0 )

-
Initializes property if it's still undefined. First argument

-
is a property name/path. It can also be nil or an empty string,

-
in which case the node itself gets initialized, rather than one

-
of its children. Second argument is the default value. The third,

-
optional argument is a property type (one of "STRING", "DOUBLE",

-
"INT", or "BOOL"). If it is omitted, then "DOUBLE" is used for

-
numbers, and STRING for everything else. Returns the property

-
as props.Node. The fourth optional argument enforces a type if

-
non-zero.

-
-

props.dump ( )

-
Useful debugging utility. Recursively dumps the full state of a

-
Node object to the console. Try binding "props.dump(props.globals)"

-
to a key for a fun hack.

-
-

props.copy ( src, dest, attr = 0 )

-
Recursively copy property branch from source Node to

-
destination Node. Doesn't copy aliases. Copies attributes

-
if optional third argument is set and non-zero.

-
-

props.wrap ( node )

-
Utility. Turns any ghosts it finds (either solo, or in an

-
array) into Node objects.

-
-

props.wrapNode ( node )

-
Utility. Returns a new object with its superclass/parent set to the

-
Node object and its _g (ghost) field set to the specified object.

-
Nasal's literal syntax can be pleasingly terse. I like that. :)

-
-

props.getNode ( return call )

-
Shortcut for props.globals.getNode().

-
-

props.setAll ( base, child, value )

-
Sets all indexed property children to a single value. arg[0]

-
specifies a property name (e.g. /controls/engines/engine), arg[1] a

-
path under each node of that name to set (e.g. "throttle"), arg[2]

-
is the value.

-
-

props.nodeList ( )

-
Turns about anything into a list of props.Nodes, including ghosts,

-
path strings, vectors or hashes containing, as well as functions

-
returning any of the former and in arbitrary nesting. This is meant

-
to be used in functions whose main purpose is to handle collections

-
of properties.

-
-

props.compileCondition ( p )

-
Compiles a <condition> property branch according to the rules

-
set out in $FG_ROOT/Docs/README.conditions into a Condition object.

-
The 'test' method of the returend object can be used to evaluate

-
the condition.

-
The function returns nil on error.

-
-

props.condition ( p )

-
Evaluates a <condition> property branch according to the rules

-
set out in $FG_ROOT/Docs/README.conditions. Undefined conditions

-
and a nil argument are "true". The function dumps the condition

-
branch and returns nil on error.

-
-

props._cond_and ( p )

-
-

props._cond_or ( p )

-
-

props._cond ( p )

-
-

props._cond_cmp ( p, op )

-
-

props.runBinding ( node, module = nil )

-
Runs <binding> as described in $FG_ROOT/Docs/README.commands using

-
a given module by default, and returns 1 if fgcommand() succeeded,

-
or 0 otherwise. The module name won't override a <module> defined

-
in the binding.

-
-

props.Node._updateProperty ( _property )

-
-

props.Node.FromProperty ( _propname, _delta, _changed_method )

-
-

props.Node.IsNumeric ( hashkey )

-
-

props.Node.FromPropertyHashList ( _keylist, _delta, _changed_method )

-
-

props.Node.FromHashValue ( _key, _delta, _changed_method )

-
-

props.Node.FromHashList ( _keylist, _delta, _changed_method )

-
-
-

redout

-

redout.run ( )

-
-
-

route_manager

-

route_manager.RouteManagerDelegate

-
-

route_manager.RouteManagerDelegate.new ( fp )

-
-

route_manager.RouteManagerDelegate.departureChanged ( )

-
-

route_manager.RouteManagerDelegate.arrivalChanged ( )

-
-

route_manager.RouteManagerDelegate.cleared ( )

-
-

route_manager.RouteManagerDelegate.endOfFlightPlan ( )

-
-

route_manager.FMSDelegate

-
-

route_manager.FMSDelegate.new ( fp )

-
-

route_manager.FMSDelegate._landingCheckTimeout ( )

-
-

route_manager.FMSDelegate.waypointsChanged ( )

-
-

route_manager.FMSDelegate.endOfFlightPlan ( )

-
-

route_manager.FMSDelegate.currentWaypointChanged ( )

-
-
-

scenery

-

scenery.sharedDoor

-
An extended aircraft.door that transmits the door events over MP using the

-
scenery.events channel.

-
Use only for single instance objects (e.g. static scenery objects).

-
Note: Currently toggle() is the only shared event.

-
-

scenery.sharedDoor.new ( node, swingtime, pos = 0 )

-
-

scenery.sharedDoor.toggle ( )

-
-

scenery.sharedDoor.destroy ( )

-
-

scenery.sharedDoor._process ( sender, msg )

-
-

scenery.sharedDoor._loop ( id )

-
-

scenery._set_state ( )

-
-
-

screen

-

screen.sanitize ( s, newline = 0 )

-
convert string for output; replaces tabs by spaces, and skips

-
delimiters and the voice part in "{text|voice}" constructions

-
-

screen.window

-
screen.window

-
------------------------------------------------------------------------------

-
Class that manages a dialog with fixed number of lines, where you can push in

-
text at the bottom, which then (optionally) scrolls up after some time.

-
simple use:

-
var window = screen.window.new();

-
window.write("message in the middle of the screen");

-
advanced use:

-
var window = screen.window.new(nil, -100, 3, 10);

-
window.fg = [1, 1, 1, 1]; choose white default color

-
window.align = "left";

-
window.write("first line");

-
window.write("second line (red)", 1, 0, 0);

-
arguments:

-
x ... x coordinate

-
y ... y coordinate

-
positive coords position relative to the left/lower corner,

-
negative coords from the right/upper corner, nil centers

-
maxlines ... max number of displayed lines; if more are pushed into the

-
screen, then the ones on top fall off

-
autoscroll ... seconds that each line should be shown; can be less if

-
a message falls off; if 0 then don't scroll at all

-
-

screen.window.new ( x = nil, y = nil, maxlines = 10, autoscroll = 10 )

-
-

screen.window.write ( msg, r = nil, g = nil, b = nil, a = nil )

-
-

screen.window.clear ( )

-
-

screen.window.show ( )

-
-

screen.window.close ( )

-
-

screen.window._write_ ( )

-
-

screen.window._timeout_ ( )

-
-

screen.window._redraw_ ( )

-
-

screen.display

-
Class that manages a dialog, which displays an arbitrary number of properties

-
periodically updating the values. Property names are abbreviated to the

-
shortest possible unique part.

-
Example:

-
var dpy = screen.display.new(20, 10); x/y coordinate

-
dpy.setcolor(1, 0, 1); magenta (default: white)

-
dpy.setfont("SANS_12B",12); see $FG_ROOT/gui/styles/*.xml

-
dpy.add("/position/latitude-deg", "/position/longitude-deg");

-
dpy.add(props.globals.getNode("/orientation").getChildren());

-
The add() method takes one or more property paths or props.Nodes, or a vector

-
containing those, or a hash with properties, or vectors with properties, etc.

-
Internal "public" parameters may be set directly:

-
dpy.interval = 0; update every frame

-
dpy.format = "%.3g"; max. 3 digits fractional part

-
dpy.tagformat = "%-12s"; align prop names to 12 spaces

-
dpy.redraw(); pick up new settings

-
The open() method should only be used to undo a close() call. In all other

-
cases this is done implicitly. redraw() is automatically called by an add(),

-
but can be used to let the dialog pick up new settings of internal variables.

-
Methods add(), setfont() and setcolor() can be appended to the new()

-
constructor (-> show big yellow frame rate counter in upper right corner):

-
screen.display.new(-15, -5, 0).setfont("TIMES_24").setcolor(1, 0.9, 0).add("/sim/frame-rate");

-
-

screen.display.new ( x, y, show_tags = 1 )

-
-

screen.display.setcolor ( r, g, b, a = 1 )

-
-

screen.display.setfont ( font, size=13 )

-
-

screen.display._create_ ( )

-
-

screen.display.open ( )

-
add() opens already, so call open() explicitly only after close()!

-
-

screen.display.close ( )

-
-

screen.display.toggle ( )

-
-

screen.display.reset ( )

-
-

screen.display.redraw ( )

-
-

screen.display.add ( p... )

-
-

screen.display.update ( )

-
-

screen.display._loop_ ( id )

-
-

screen.display.nameof ( n )

-
-

screen.listener

-
-

screen.search_name_in_msg ( msg, call )

-
-

screen.msg_mp ( n )

-
highlights messages with the multiplayer callsign in the text

-
-

screen.msg_repeat ( )

-
-
-

seaport

-
-

string

-

string.iscntrl ( c )

-
-

string.isascii ( c )

-
-

string.isupper ( c )

-
-

string.islower ( c )

-
-

string.isdigit ( c )

-
-

string.isblank ( c )

-
-

string.ispunct ( c )

-
-

string.isxdigit ( c )

-
-

string.isspace ( c )

-
-

string.isalpha ( c )

-
-

string.isalnum ( c )

-
-

string.isgraph ( c )

-
-

string.isprint ( c )

-
-

string.toupper ( c )

-
-

string.tolower ( c )

-
-

string.isxspace ( c )

-
-

string.trim ( s, lr = 0, istrim = nil )

-
trim spaces at the left (lr < 0), at the right (lr > 0), or both (lr = 0)

-
An optional function argument defines which characters should be trimmed:

-
string.trim(a); trim spaces

-
string.trim(a, 1, string.isdigit); trim digits at the right

-
string.trim(a, 0, func(c) c == `\\` or c == `/`); trim slashes/backslashes

-
-

string.truncateAt ( src, match )

-
truncate at the first match

-
string.truncateAt("file.xml", ".xml"); "file.xml" -> "file"

-
string.truncateAt("file.xml", ".txt"); "file.xml" -> "file.xml"

-
-

string.lc ( str )

-
return string converted to lower case letters

-
-

string.uc ( str )

-
return string converted to upper case letters

-
-

string.icmp ( a, b )

-
case insensitive string compare and match functions

-
(not very efficient -- converting the array to be sorted

-
first is faster)

-
-

string.imatch ( a, b )

-
-

string.compileTemplate ( template, type=nil )

-
Get a function out of a string template for fast insertion of template

-
parameters. This allows to use the same templates as with most available tile

-
mapping engines (eg. Leaflet, Polymaps). Return a callable function object on

-
success, and nil if parsing the templated fails. See string._template_getargs

-
for more on calling a compile object.

-
Example (Build MapQuest tile url):

-
var makeUrl = string.compileTemplate(

-
"http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg"

-
);

-
print( makeUrl({x: 5, y: 4, z: 3}) );

-
Output:

-
http://otile1.mqcdn.com/tiles/1.0.0/map/3/5/4.jpg

-
-

string._template_getargs ( )

-
Private function used by string.naCompileTemplate. Expands any __ENV parameter

-
into the locals of the caller. This allows both named arguments and manual hash

-
arguments via __ENV.

-
Examples using (format = func(__ENV) {string._template_getargs()}):

-
Pass arguments as hash:

-
format({a: 1, "b ":2});

-
Or:

-
format(__ENV:{a: 1, "b ":2});

-
Pass arguments as named:

-
format(a: 1, "b ":2);

-
Pass arguments as both named and hash, using

-
__ENV to specify the latter:

-
format(a: 1, __ENV:{"b ": 2});

-
-

string.Scan

-
Simple scanf function. Takes an input string, a pattern, and a

-
vector. It returns 0 if the format didn't match, and appends

-
all found elements to the given vector. Return values:

-
-1 string matched format ending with % (i.e. more chars than format cared about)

-
0 string didn't match format

-
1 string matched, but would still match if the right chars were added

-
2 string matched, and would not if any character would be added

-
var r = string.scanf("comm3freq123.456", "comm%ufreq%f", var result = []);

-
The result vector will be set to [3, 123.456].

-
-

string.Scan.new ( s )

-
-

string.Scan.getc ( )

-
-

string.Scan.ungetc ( )

-
-

string.Scan.rest ( )

-
-

string.scanf ( test, format, result )

-
-

string.setcolors ( enabled )

-
ANSI colors (see $ man console_codes)

-
-

string.color ( color, s, enabled=nil )

-
-
-

tanker

-

tanker.oclock ( bearing )

-
-

tanker.tanker_msg ( setprop )

-
-

tanker.pilot_msg ( setprop )

-
-

tanker.atc_msg ( setprop )

-
-

tanker.skip_cloud_layer ( alt )

-
-

tanker.identity

-
-

tanker.identity.get ( )

-
-

tanker.Tanker

-
-

tanker.Tanker.new ( aiid, callsign, tacan, type, model, kias, maxfuel, pattern, contacts, heading, coord )

-
-

tanker.Tanker.del ( )

-
-

tanker.Tanker.update ( )

-
-

tanker.Tanker.identify ( )

-
-

tanker.Tanker.report ( )

-
-

tanker.create_tanker ( tanker_node, course )

-
Create a tanker based on a given /sim/ai/tankers/tanker property node

-
-

tanker.request_new ( tanker_node=nil )

-
Request a new tanker

-
-

tanker.request ( tanker_node=nil )

-
-

tanker.request_random ( tanker_node=nil )

-
-

tanker.report ( )

-
-

tanker.reinit ( )

-
-
-

track_target

-

track_target.TrackInit ( )

-
Initialize target tracking

-
-

track_target.TrackUpdate ( loop_id )

-
If enabled, update our AP target values based on the target range,

-
bearing, and speed

-
-
-

video

-

video.save ( )

-
-
-

view

-

view.hasmember ( class, member )

-
-

view.calcMul ( )

-
-

view.increase ( )

-
Handler. Increase FOV by one step

-
-

view.decrease ( )

-
Handler. Decrease FOV by one step

-
-

view.resetFOV ( )

-
Handler. Reset FOV to default.

-
-

view.resetViewPos ( )

-
-

view.resetViewDir ( )

-
-

view.stepView ( step, force = 0 )

-
Handler. Step to the next (force=1) or next enabled view.

-
-

view.indexof ( name )

-
Get view index by name.

-
-

view.panViewDir ( step )

-
Pans the view horizontally. The argument specifies a relative rate

-
(or number of "steps" -- same thing) to the standard rate.

-
-

view.panViewPitch ( step )

-
Pans the view vertically. The argument specifies a relative rate

-
(or number of "steps" -- same thing) to the standard rate.

-
-

view.resetView ( )

-
Reset view to default using current view manager (see default_handler).

-
-

view.default_handler

-
Default view handler used by view.manager.

-
-

view.default_handler.reset ( )

-
-

view.manager

-
View manager. Administrates optional Nasal view handlers.

-
Usage: view.manager.register(<view-id>, <view-handler>);

-
view-id: the view's name (e.g. "Chase View") or index number

-
view-handler: a hash with any combination of the functions listed in the

-
following example, or none at all. Only define the interface

-
functions that you really need! The hash may contain local

-
variables and other, non-interface functions.

-
Example:

-
var some_view_handler = {

-
init : func {}, called only once at startup

-
start : func {}, called when view is switched to our view

-
stop : func {}, called when view is switched away from our view

-
reset : func {}, called with view.resetView()

-
update : func { 0 }, called iteratively if defined. Must return

-
}; interval in seconds until next invocation

-
Don't define it if you don't need it!

-
view.manager.register("Some View", some_view_handler);

-
-

view.manager.init ( )

-
-

view.manager.register ( which, handler = nil )

-
-

view.manager.set_view ( which = nil )

-
-

view.manager.reset ( )

-
-

view.manager._loop_ ( id )

-
-

view.fly_by_view_handler

-
-

view.fly_by_view_handler.init ( )

-
-

view.fly_by_view_handler.start ( )

-
-

view.fly_by_view_handler.reset ( )

-
-

view.fly_by_view_handler.setpos ( force = 0 )

-
-

view.fly_by_view_handler.update ( )

-
-

view.model_view_handler

-
-

view.model_view_handler.init ( node )

-
-

view.model_view_handler.start ( )

-
-

view.model_view_handler.stop ( )

-
-

view.model_view_handler.reset ( )

-
-

view.model_view_handler.find ( callsign )

-
-

view.model_view_handler.select ( which, by_callsign=0 )

-
-

view.model_view_handler.next ( step )

-
-

view.model_view_handler._update_ ( )

-
-

view.model_view_handler.setup ( data )

-
-

view.pilot_view_limiter

-
-

view.pilot_view_limiter.new ( )

-
-

view.pilot_view_limiter.init ( )

-
-

view.pilot_view_limiter.start ( )

-
-

view.pilot_view_limiter.update ( )

-
-

view.panViewDir ( step )

-
-

view.normdeg ( a )

-
Normalize angle to -180 <= angle < 180

-
-

view.ViewAxis

-
Manages one translation/rotation axis. (For simplicity reasons the

-
field-of-view parameter is also managed by this class.)

-
-

view.ViewAxis.new ( prop )

-
-

view.ViewAxis.reset ( )

-
-

view.ViewAxis.target ( v )

-
-

view.ViewAxis.move ( blend )

-
-

view.point

-
view.point: handles smooth view movements

-
-

view.point.init ( )

-
-

view.point.save ( )

-
-

view.point.restore ( )

-
-

view.point.move ( prop, time = nil )

-
-

view.point._loop_ ( id, time )

-
-

view.screenWidthCompens

-
-

view.screenWidthCompens.getStatus ( me.statusNode.getValue )

-
-

view.screenWidthCompens.setStatus ( state )

-
-

view.screenWidthCompens.getDimensions ( )

-
-

view.screenWidthCompens.calcNewFov ( fov=55, oldW=nil, oldH=nil, w=nil, h=nil )

-
-

view.screenWidthCompens.init ( )

-
-

view.screenWidthCompens.toggle ( )

-
-

view.screenWidthCompens.update ( opt=nil, force=0 )

-
-
-

volcano

-

volcano.volcano

-
-

volcano.volcano.new ( name, lat, lon )

-
-

volcano.volcano_manager

-
-

volcano.volcano_manager.init ( )

-
-

volcano.volcano_manager.start ( )

-
-

volcano.volcano_manager.init_state ( )

-
-

volcano.volcano_manager.set_state ( )

-
-

volcano.volcano_manager.run ( index )

-
-

volcano.set_kilauea ( )

-
-

volcano.set_stromboli ( )

-
-

volcano.set_etna ( )

-
-

volcano.set_beerenberg ( )

-
-
-

weather_scenario

-

weather_scenario.initialize_weather_scenario ( )

-
-
-

wildfire

-

wildfire.trace ( )

-
Set this to print for debug.

-
-

wildfire.ignite ( pos, source=1 )

-
Start a fire.

-
pos - fire location : geo.Coord

-
source - broadcast event? : bool

-
-

wildfire.resolve_water_drop ( pos, radius, volume, source=1 )

-
Resolve a water drop impact.

-
pos - drop location : geo.Coord

-
radius - drop radius m : double

-
volume - drop volume m3 : double

-
-

wildfire.resolve_retardant_drop ( pos, radius, volume, source=1 )

-
Resolve a retardant drop impact.

-
pos - drop location : geo.Coord

-
radius - drop radius : double

-
volume - drop volume : double

-
-

wildfire.resolve_foam_drop ( pos, radius, volume, source=1 )

-
Resolve a foam drop impact.

-
pos - drop location : geo.Coord

-
radius - drop radius : double

-
volume - drop volume : double

-
-

wildfire.load_event_log ( filename, skip_ahead_until )

-
Load an event log.

-
skip_ahead_until - skip from last event to this time : double (epoch)

-
fast forward from skip_ahead_until

-
to current time.

-
x < last event - fast forward all the way to current time (use 0).

-
NOTE: Can be VERY time consuming.

-
-1 - skip to current time.

-
-

wildfire.save_event_log ( filename )

-
Save an event log.

-
-

wildfire.print_score ( )

-
Print current score summary.

-
-

wildfire.mp_last_limited_event

-
-

wildfire.score_report_loop ( )

-
Utility functions.

-
-

wildfire.ignition_msg ( pos )

-
-

wildfire.water_drop_msg ( pos, radius, volume )

-
-

wildfire.retardant_drop_msg ( pos, radius, volume )

-
-

wildfire.foam_drop_msg ( pos, radius, volume )

-
-

wildfire.parse_msg ( source, msg )

-
-

wildfire.SimTime

-
-

wildfire.SimTime.init ( )

-
-

wildfire.SimTime.current_time ( )

-
-

wildfire.FireCell

-
Class that maintains the state of one fire cell.

-
-

wildfire.FireCell.new ( x, y )

-
-

wildfire.FireCell.ignite ( )

-
-

wildfire.FireCell.extinguish ( type= )

-
-

wildfire.FireCell.update ( )

-
-

wildfire.FireCell.get_neighbour_burn ( create )

-
Get neightbour burn values.

-
-

wildfire.CellModel

-
Class that maintains the 3d model(s) for one fire cell.

-
-

wildfire.CellModel.new ( x, y, alt )

-
-

wildfire.CellModel.set_type ( type )

-
-

wildfire.CellModel.remove ( )

-
-

wildfire.CAFireModels

-
Singleton that maintains the CA models.

-
-

wildfire.CAFireModels.init ( )

-
Public operations

-
-

wildfire.CAFireModels.reset ( enabled )

-
Reset the model grid to the empty state.

-
-

wildfire.CAFireModels.start ( )

-
Start the CA model grid.

-
-

wildfire.CAFireModels.stop ( )

-
Stop the CA model grid.

-
Note that it will catch up lost time when started again.

-
-

wildfire.CAFireModels.add ( x, y, alt )

-
Add a new cell model.

-
-

wildfire.CAFireModels.set_type ( x, y, type )

-
Update a cell model.

-
-

wildfire.CAFireModels.set_models_enabled ( on=1 )

-
-

wildfire.CAFireModels.update ( )

-
Private operations

-
-

wildfire.CAFire

-
Singleton that maintains the fire cell CA grid.

-
-

wildfire.CAFire.init ( )

-
Public operations

-
-

wildfire.CAFire.reset ( enabled, sim_time )

-
Reset the CA to the empty state and set its current time to sim_time.

-
-

wildfire.CAFire.start ( )

-
Start the CA.

-
-

wildfire.CAFire.stop ( )

-
Stop the CA. Note that it will catch up lost time when started again.

-
-

wildfire.CAFire.ignite ( lat, lon )

-
Start a fire in the cell at pos.

-
-

wildfire.CAFire.resolve_water_drop ( lat, lon, radius, volume=0 )

-
Resolve a water drop.

-
For now: Assume that water makes the affected cell nonflammable forever

-
and extinguishes it if burning.

-
radius - meter : double

-
Note: volume is unused ATM.

-
-

wildfire.CAFire.resolve_retardant_drop ( lat, lon, radius, volume=0 )

-
Resolve a fire retardant drop.

-
For now: Assume that the retardant makes the affected cell nonflammable

-
forever and extinguishes it if burning.

-
Note: volume is unused ATM.

-
-

wildfire.CAFire.resolve_foam_drop ( lat, lon, radius, volume=0 )

-
Resolve a foam drop.

-
For now: Assume that water makes the affected cell nonflammable forever

-
and extinguishes it if burning.

-
radius - meter : double

-
Note: volume is unused ATM.

-
-

wildfire.CAFire.save_event_log ( filename )

-
Save the current event log.

-
This is modelled on Melchior FRANZ's ac_state.nas.

-
-

wildfire.CAFire.load_event_log ( filename, skip_ahead_until )

-
Load an event log.

-
skip_ahead_until - skip from last event to this time : double (epoch)

-
fast forward from skip_ahead_until

-
to current time.

-
x < last event - fast forward all the way to current time (use 0).

-
-1 - skip to current time.

-
-

wildfire.CAFire.get_cell ( x, y )

-
Internal operations

-
-

wildfire.CAFire.set_cell ( x, y, cell )

-
-

wildfire.CAFire.update ( )

-
-

wildfire.CAFire.loop ( )

-
-

wildfire.time_string_to_epoch ( time )

-
Convert a time string in the format yyyy[:mm[:dd[:hh[:mm[:ss]]]]]

-
to seconds since 1970:01:01:00:00:00.

-
Note: This is an over simplified approximation.

-
-

wildfire.dialog

-
-

wildfire.dialog.init ( x = nil, y = nil )

-
-

wildfire.dialog.create ( )

-
-

wildfire.dialog.close ( )

-
-

wildfire.dialog.destroy ( )

-
-

wildfire.dialog.show ( )

-
-

wildfire.dialog.select_and_load ( )

-
-
-

windsock

-

windsock.windsock ( )

-
-
-

FailureMgr

-

FailureMgr.FailureMode

-
-

FailureMgr.FailureMode.new ( id, description, actuator )

-
-

FailureMgr.FailureMode.set_failure_level ( level )

-
-

FailureMgr.FailureMode._set_failure_level ( level )

-
-

FailureMgr.FailureMode.get_failure_level ( me.actuator.get_failure_level )

-
-

FailureMgr.FailureMode.bind ( path )

-
-

FailureMgr.FailureMode.unbind ( )

-
-

FailureMgr._failmgr

-
-

FailureMgr._failmgr.init ( )

-
-

FailureMgr._failmgr.add_failure_mode ( mode )

-
-

FailureMgr._failmgr.get_failure_modes ( )

-
-

FailureMgr._failmgr.remove_failure_mode ( id )

-
-

FailureMgr._failmgr.remove_all ( )

-
-

FailureMgr._failmgr.repair_all ( )

-
-

FailureMgr._failmgr.set_trigger ( mode_id, trigger )

-
-

FailureMgr._failmgr.get_trigger ( mode_id )

-
-

FailureMgr._failmgr.on_trigger_activated ( trigger )

-
-

FailureMgr._failmgr._enable ( )

-
-

FailureMgr._failmgr._disable ( )

-
-

FailureMgr._failmgr.enabled ( )

-
-

FailureMgr._failmgr.log ( message )

-
-

FailureMgr._failmgr._update ( )

-
-

FailureMgr._failmgr._discard_trigger ( trigger )

-
-

FailureMgr._failmgr._on_teleport ( pnode )

-
-

FailureMgr._failmgr.dump_status ( mode_ids=nil )

-
-

FailureMgr._init ( )

-
-

FailureMgr.events

-
-

FailureMgr.get_id ( category, failure_mode )

-
-

FailureMgr.split_id ( mode_id )

-
-

FailureMgr.add_failure_mode ( id, description, actuator )

-
-

FailureMgr.get_failure_modes ( )

-
-

FailureMgr.remove_failure_mode ( id )

-
-

FailureMgr.remove_all ( )

-
-

FailureMgr.set_trigger ( mode_id, trigger )

-
-

FailureMgr.get_trigger ( mode_id )

-
-

FailureMgr.set_failure_level ( mode_id, level )

-
-

FailureMgr.get_failure_level ( mode_id )

-
-

FailureMgr.repair_all ( )

-
-

FailureMgr.get_log_buffer ( )

-
-

FailureMgr.enable ( setprop )

-
-

FailureMgr.disable ( setprop )

-
-

FailureMgr.Trigger

-
-

FailureMgr.Trigger.new ( )

-
-

FailureMgr.Trigger.on_fire ( 0, - )

-
Async triggers shall call the on_fire() callback when their fire

-
conditions are met to notify the failure manager.

-
-

FailureMgr.Trigger.update ( 0, - )

-
-

FailureMgr.Trigger.to_str ( )

-
-

FailureMgr.Trigger.set_param ( param, value )

-
-

FailureMgr.Trigger.arm ( )

-
-

FailureMgr.Trigger._arm ( )

-
-

FailureMgr.Trigger.disarm ( )

-
-

FailureMgr.Trigger._disarm ( )

-
-

FailureMgr.Trigger.enable ( )

-
-

FailureMgr.Trigger.disable ( )

-
-

FailureMgr.Trigger.bind ( path )

-
-

FailureMgr.Trigger.unbind ( )

-
-

FailureMgr.FailureActuator

-
-

FailureMgr.FailureActuator.set_failure_level ( level )

-
-

FailureMgr.FailureActuator.get_failure_level ( 0, - )

-
-
-

canvas

-

canvas._getColor ( color )

-
Internal helper

-
-

canvas._arg2valarray ( )

-
-

canvas.Transform

-
Transform

-
A transformation matrix which is used to transform an Element on the canvas.

-
The dimensions of the matrix are 3x3 where the last row is always 0 0 1:

-
a c e

-
b d f

-
0 0 1

-
See http://www.w3.org/TR/SVG/coords.htmlTransformMatrixDefined for details.

-
-

canvas.Transform.new ( node, vals = nil )

-
-

canvas.Transform.setTranslation ( )

-
-

canvas.Transform.setRotation ( angle )

-
Set rotation (Optionally around a specified point instead of (0,0))

-
setRotation(rot)

-
setRotation(rot, cx, cy)

-
@note If using with rotation center different to (0,0) don't use

-
setTranslation as it would interfere with the rotation.

-
-

canvas.Transform.setScale ( )

-
Set scale (either as parameters or array)

-
If only one parameter is given its value is used for both x and y

-
setScale(x, y)

-
setScale([x, y])

-
-

canvas.Transform.getScale ( )

-
-

canvas.Element

-
Element

-
Baseclass for all elements on a canvas

-
-

canvas.Element.new ( ghost )

-
Constructor

-
@param ghost Element ghost as retrieved from core methods

-
-

canvas.Element.getParent ( )

-
Get parent group/element

-
-

canvas.Element.getCanvas ( )

-
Get the canvas this element is placed on

-
-

canvas.Element.equals ( el )

-
Check if elements represent same instance

-
@param el Other Element or element ghost

-
-

canvas.Element.setVisible ( visible = 1 )

-
Hide/Show element

-
@param visible Whether the element should be visible

-
-

canvas.Element.getVisible ( me.getBool )

-
-

canvas.Element.hide ( me.setVisible )

-
Hide element (Shortcut for setVisible(0))

-
-

canvas.Element.show ( me.setVisible )

-
Show element (Shortcut for setVisible(1))

-
-

canvas.Element.toggleVisibility ( me.setVisible )

-
Toggle element visibility

-
-

canvas.Element.setGeoPosition ( lat, lon )

-
-

canvas.Element.createTransform ( vals = nil )

-
Create a new transformation matrix

-
@param vals Default values (Vector of 6 elements)

-
-

canvas.Element.setTranslation ( )

-
Shortcut for setting translation

-
-

canvas.Element.getTranslation ( )

-
Get translation set with setTranslation

-
-

canvas.Element.setRotation ( rot )

-
Set rotation around transformation center (see setCenter).

-
@note This replaces the the existing transformation. For additional scale or

-
translation use additional transforms (see createTransform).

-
-

canvas.Element.setScale ( )

-
Shortcut for setting scale

-
-

canvas.Element.getScale ( me._getTf )

-
Shortcut for getting scale

-
-

canvas.Element.setColorFill ( me.set )

-
Set the fill/background/boundingbox color

-
@param color Vector of 3 or 4 values in [0, 1]

-
-

canvas.Element.getColorFill ( me.get )

-
-

canvas.Element.getTransformedBounds ( me.getTightBoundingBox )

-
-

canvas.Element.updateCenter ( )

-
Calculate the transformation center based on bounding box and center-offset

-
-

canvas.Element.setCenter ( )

-
Set transformation center (currently only used for rotation)

-
-

canvas.Element.getCenter ( )

-
Get transformation center

-
-

canvas.Element.boundingbox2clip ( bb )

-
convert bounding box vector into clip string (yes, different order)

-
-

canvas.Element.setClipByBoundingBox ( bounding_box, clip_frame = nil )

-
set clip by bounding box

-
bounding_box: [xmin, ymin, xmax, ymax]

-
-

canvas.Element.setClipByElement ( clip_elem )

-
set clipping by bounding box of another element

-
-

canvas.Element._getTf ( )

-
Internal Transform for convenience transform functions

-
-

canvas.Element._setupCenterNodes ( cx = nil, cy = nil )

-
-

canvas.Group

-
Group

-
Class for a group element on a canvas

-
-

canvas.Group.new ( ghost )

-
public:

-
-

canvas.Group.createChild ( type, id = nil )

-
Create a child of given type with specified id.

-
type can be group, text

-
-

canvas.Group.createChildren ( type, count )

-
Create multiple children of given type

-
-

canvas.Group.rect ( x, y, w, h, cfg = nil )

-
Create a path child drawing a (rounded) rectangle

-
@param x Position of left border

-
@param y Position of top border

-
@param w Width

-
@param h Height

-
@param cfg Optional settings (eg. {"border-top-radius": 5})

-
-

canvas.Group.getChildren ( )

-
Get a vector of all child elements

-
-

canvas.Group.getChildrenOfType ( type, array = nil )

-
Recursively get all children of class specified by first param

-
-

canvas.Group.setColor ( )

-
Set color to children of type Path and Text. It is possible to optionally

-
specify which types of children should be affected by passing a vector as

-
the last agrument, ie. my_group.setColor(1,1,1,[Path]);

-
-

canvas.Group.getElementById ( id )

-
Get first child with given id (breadth-first search)

-
@note Use with care as it can take several miliseconds (for me eg. ~2ms).

-
TODO check with new C++ implementation

-
-

canvas.Group.removeAllChildren ( )

-
Remove all children

-
-

canvas.Group._isElementNode ( el )

-
private:

-
-

canvas.Group._wrapElement ( node )

-
-

canvas.Group._getFactory ( type )

-
-

canvas.Map

-
Map

-
Class for a group element on a canvas with possibly geographic positions

-
which automatically get projected according to the specified projection.

-
Each map consists of an arbitrary number of layers (canvas groups)

-
-

canvas.Map.new ( ghost )

-
-

canvas.Map.del ( )

-
-

canvas.Map.setController ( controller=nil, arg... )

-
-

canvas.Map.getController ( )

-
-

canvas.Map.addLayer ( factory, type_arg=nil, priority=nil, style=nil, opts=nil, visible=1 )

-
-

canvas.Map.getLayer ( type_arg )

-
-

canvas.Map.setRange ( range )

-
-

canvas.Map.setScreenRange ( range )

-
-

canvas.Map.setPos ( lat, lon, hdg=nil, range=nil, alt=nil )

-
-

canvas.Map.getPos ( )

-
-

canvas.Map.getLat ( me.get )

-
-

canvas.Map.getLon ( me.get )

-
-

canvas.Map.getHdg ( me.get )

-
-

canvas.Map.getAlt ( me.get )

-
-

canvas.Map.getRange ( me.get )

-
-

canvas.Map.getScreenRange ( me.get )

-
-

canvas.Map.getLatLon ( )

-
-

canvas.Map.getPosCoord ( )

-
N.B.: This always returns the same geo.Coord object,

-
so its values can and will change at any time (call

-
update() on the coord to ensure it is up-to-date,

-
which basically calls this method again).

-
-

canvas.Map.update ( predicate=nil )

-
Update each layer on this Map. Called by

-
me.controller.

-
-

canvas.Text

-
Text

-
Class for a text element on a canvas

-
-

canvas.Text.new ( ghost )

-
-

canvas.Text.setText ( text )

-
Set the text

-
-

canvas.Text.getText ( )

-
-

canvas.Text.enableUpdate ( )

-
enable reduced property I/O update function

-
-

canvas.Text.updateText ( text )

-
reduced property I/O text update template

-
-

canvas.Text.enableFast ( )

-
enable fast setprop-based text writing

-
-

canvas.Text.setTextFast ( text )

-
fast, setprop-based text writing template

-
-

canvas.Text.appendText ( text )

-
append text to an existing string

-
-

canvas.Text.setAlignment ( align )

-
Set alignment

-
@param align String, one of:

-
left-top

-
left-center

-
left-bottom

-
center-top

-
center-center

-
center-bottom

-
right-top

-
right-center

-
right-bottom

-
left-baseline

-
center-baseline

-
right-baseline

-
left-bottom-baseline

-
center-bottom-baseline

-
right-bottom-baseline

-
-

canvas.Text.setFontSize ( size, aspect = 1 )

-
Set the font size

-
-

canvas.Text.setFont ( name )

-
Set font (by name of font file)

-
-

canvas.Text.setDrawMode ( mode )

-
Set draw mode. Binary combination of the values above. Since I haven't found

-
a bitwise or we have to use a + instead.

-
eg. my_text.setDrawMode(Text.TEXT + Text.BOUNDINGBOX);

-
-

canvas.Text.setPadding ( pad )

-
Set bounding box padding

-
-

canvas.Text.setMaxWidth ( w )

-
-

canvas.Text.setColor ( me.set )

-
-

canvas.Text.getColor ( me.get )

-
-

canvas.Text.setColorFill ( me.set )

-
-

canvas.Text.getColorFill ( me.get )

-
-

canvas.Path

-
Path

-
Class for an (OpenVG) path element on a canvas

-
-

canvas.Path.new ( ghost )

-
-

canvas.Path.reset ( )

-
Remove all existing path data

-
-

canvas.Path.setData ( cmds, coords )

-
Set the path data (commands and coordinates)

-
-

canvas.Path.setDataGeo ( cmds, coords )

-
-

canvas.Path.addSegment ( cmd, coords... )

-
Add a path segment

-
-

canvas.Path.addSegmentGeo ( cmd, coords... )

-
-

canvas.Path.pop_front ( me._removeSegment )

-
Remove first segment

-
-

canvas.Path.pop_back ( me._removeSegment )

-
Remove last segment

-
-

canvas.Path.getNumSegments ( )

-
Get the number of segments

-
-

canvas.Path.getNumCoords ( )

-
Get the number of coordinates (each command has 0..n coords)

-
-

canvas.Path.moveTo ( me.addSegment )

-
Move path cursor

-
-

canvas.Path.move ( me.addSegment )

-
-

canvas.Path.lineTo ( me.addSegment )

-
Add a line

-
-

canvas.Path.line ( me.addSegment )

-
-

canvas.Path.horizTo ( me.addSegment )

-
Add a horizontal line

-
-

canvas.Path.horiz ( me.addSegment )

-
-

canvas.Path.vertTo ( me.addSegment )

-
Add a vertical line

-
-

canvas.Path.vert ( me.addSegment )

-
-

canvas.Path.quadTo ( me.addSegment )

-
Add a quadratic BΓ©zier curve

-
-

canvas.Path.quad ( me.addSegment )

-
-

canvas.Path.cubicTo ( me.addSegment )

-
Add a cubic BΓ©zier curve

-
-

canvas.Path.cubic ( me.addSegment )

-
-

canvas.Path.squadTo ( me.addSegment )

-
Add a smooth quadratic BΓ©zier curve

-
-

canvas.Path.squad ( me.addSegment )

-
-

canvas.Path.scubicTo ( me.addSegment )

-
Add a smooth cubic BΓ©zier curve

-
-

canvas.Path.scubic ( me.addSegment )

-
-

canvas.Path.arcSmallCCWTo ( me.addSegment )

-
Draw an elliptical arc (shorter counter-clockwise arc)

-
-

canvas.Path.arcSmallCCW ( me.addSegment )

-
-

canvas.Path.arcSmallCWTo ( me.addSegment )

-
Draw an elliptical arc (shorter clockwise arc)

-
-

canvas.Path.arcSmallCW ( me.addSegment )

-
-

canvas.Path.arcLargeCCWTo ( me.addSegment )

-
Draw an elliptical arc (longer counter-clockwise arc)

-
-

canvas.Path.arcLargeCCW ( me.addSegment )

-
-

canvas.Path.arcLargeCWTo ( me.addSegment )

-
Draw an elliptical arc (shorter clockwise arc)

-
-

canvas.Path.arcLargeCW ( me.addSegment )

-
-

canvas.Path.close ( me.addSegment )

-
Close the path (implicit lineTo to first point of path)

-
-

canvas.Path.rect ( x, y, w, h, cfg = nil )

-
Add a (rounded) rectangle to the path

-
@param x Position of left border

-
@param y Position of top border

-
@param w Width

-
@param h Height

-
@param cfg Optional settings (eg. {"border-top-radius": 5})

-
-

canvas.Path.square ( x, y, l, cfg = nil )

-
Add a (rounded) square to the path

-
@param x Position of left border

-
@param y Position of top border

-
@param l length

-
@param cfg Optional settings (eg. {"border-top-radius": 5})

-
-

canvas.Path.ellipse ( rx, ry, cx = nil, cy = nil )

-
Add an ellipse to the path

-
@param rx radius x

-
@param ry radius y

-
@param cx (optional) center x coordinate or vector [cx, cy]

-
@param cy (optional) center y coordinate

-
-

canvas.Path.circle ( r, cx = nil, cy = nil )

-
Add a circle to the path

-
@param r radius

-
@param cx (optional) center x coordinate or vector [cx, cy]

-
@param cy (optional) center y coordinate

-
-

canvas.Path.setColor ( me.setStroke )

-
-

canvas.Path.getColor ( me.getStroke )

-
-

canvas.Path.setColorFill ( me.setFill )

-
-

canvas.Path.getColorFill ( me.getColorFill )

-
-

canvas.Path.setFill ( fill )

-
-

canvas.Path.setStroke ( stroke )

-
-

canvas.Path.getStroke ( me.get )

-
-

canvas.Path.setStrokeLineWidth ( width )

-
-

canvas.Path.setStrokeLineCap ( linecap )

-
Set stroke linecap

-
@param linecap String, "butt", "round" or "square"

-
See http://www.w3.org/TR/SVG/painting.htmlStrokeLinecapProperty for details

-
-

canvas.Path.setStrokeLineJoin ( linejoin )

-
Set stroke linejoin

-
@param linejoin String, "miter", "round" or "bevel"

-
See http://www.w3.org/TR/SVG/painting.htmlStrokeLinejoinProperty for details

-
-

canvas.Path.setStrokeDashArray ( pattern )

-
Set stroke dasharray

-
Set stroke dasharray

-
@param pattern Vector, Vector of alternating dash and gap lengths

-
[on1, off1, on2, ...]

-
-

canvas.Path._removeSegment ( front )

-
private:

-
-

canvas.Image

-
Image

-
Class for an image element on a canvas

-
-

canvas.Image.new ( ghost )

-
-

canvas.Image.setFile ( file )

-
Set image file to be used

-
@param file Path to file or canvas (Use canvas://... for canvas, eg.

-
canvas://by-index/texture[0])

-
-

canvas.Image.setSourceRect ( )

-
Set rectangular region of source image to be used

-
@param left Rectangle minimum x coordinate

-
@param top Rectangle minimum y coordinate

-
@param right Rectangle maximum x coordinate

-
@param bottom Rectangle maximum y coordinate

-
@param normalized Whether to use normalized ([0,1]) or image

-
([0, image_width]/[0, image_height]) coordinates

-
-

canvas.Image.setSize ( )

-
Set size of image element

-
@param width

-
@param height

-
- or -

-
@param size ([width, height])

-
-

canvas.Canvas

-
Canvas

-
Class for a canvas

-
-

canvas.Canvas.addPlacement ( vals )

-
Place this canvas somewhere onto the object. Pass criterions for placement

-
as a hash, eg:

-
my_canvas.addPlacement({

-
"texture": "EICAS.png",

-
"node": "PFD-Screen",

-
"parent": "Some parent name"

-
});

-
Note that we can choose whichever of the three filter criterions we use for

-
matching the target object for our placement. If none of the three fields is

-
given every texture of the model will be replaced.

-
-

canvas.Canvas.createGroup ( id = nil )

-
Create a new group with the given name

-
@param id Optional id/name for the group

-
-

canvas.Canvas.getGroup ( id )

-
Get the group with the given name

-
-

canvas.Canvas.setColorBackground ( me.set )

-
Set the background color

-
@param color Vector of 3 or 4 values in [0, 1]

-
-

canvas.Canvas.getColorBackground ( me.get )

-
-

canvas.Canvas.getPath ( )

-
Get path of canvas to be used eg. in Image::setFile

-
-

canvas.Canvas.del ( )

-
Destructor

-
releases associated canvas and makes this object unusable

-
-

canvas.wrapCanvas ( g )

-
@param g Canvas ghost

-
-

canvas.new ( vals )

-
Create a new canvas. Pass parameters as hash, eg:

-
var my_canvas = canvas.new({

-
"name": "PFD-Test",

-
"size": [512, 512],

-
"view": [768, 1024],

-
"mipmapping": 1

-
});

-
-

canvas.get ( arg )

-
Get the first existing canvas with the given name

-
@param name Name of the canvas

-
@return Canvas, if canvas with name exists

-
nil, otherwise

-
-

canvas.getDesktop ( )

-
-

canvas.gui

-
-

canvas.loadGUIFile ( file )

-
-

canvas.loadWidget ( name )

-
-

canvas.loadDialog ( name )

-
-

canvas.WindowButton

-
-

canvas.WindowButton.new ( parent, name )

-
-

canvas.WindowButton._onStateChange ( )

-
protected:

-
-

canvas.Window

-
-

canvas.Window.new ( size, type = nil, id = nil )

-
Constructor

-
@param size ([width, height])

-
-

canvas.Window.del ( )

-
Destructor

-
-

canvas.Window.setTitle ( title )

-
-

canvas.Window.createCanvas ( )

-
Create the canvas to be used for this Window

-
@return The new canvas

-
-

canvas.Window.setCanvas ( canvas_ )

-
Set an existing canvas to be used for this Window

-
-

canvas.Window.getCanvas ( create = 0 )

-
Get the displayed canvas

-
-

canvas.Window.getCanvasDecoration ( )

-
-

canvas.Window.setLayout ( l )

-
-

canvas.Window.setFocus ( )

-
-

canvas.Window.clearFocus ( )

-
-

canvas.Window.setPosition ( )

-
-

canvas.Window.setSize ( )

-
-

canvas.Window.getSize ( )

-
-

canvas.Window.move ( )

-
-

canvas.Window.raise ( )

-
Raise to top of window stack

-
-

canvas.Window.onResize ( )

-
-

canvas.Window._onStateChange ( )

-
protected:

-
-

canvas.Window._propCallback ( child, mode )

-
private:

-
-

canvas.Window._handlePositionAbsolute ( child, mode, name, index )

-
-

canvas.Window._updatePos ( index, name )

-
-

canvas.Window._handleResize ( child, name )

-
-

canvas.Window._updateDecoration ( )

-
-

canvas.Window._resizeDecoration ( )

-
-

canvas.Dialog

-
Provide old 'Dialog' for backwards compatiblity (should be removed for 3.0)

-
-

canvas.Dialog.new ( size, type = nil, id = nil )

-
-

canvas.register_callback ( c )

-
-

canvas.run_callbacks ( foreach )

-
-

canvas.assert ( label, expr )

-
-

canvas.SURFACECOLORS

-
Mapping from surface codes to colors (shared by runways.draw and taxiways.draw)

-
-

canvas.draw_layer ( layer, callback, lod )

-
ALL LayeredMap "draws" go through this wrapper, which makes it easy to check what's going on:

-
-

canvas.Runway

-
Runway

-
-

canvas.Runway.new ( rwy )

-
Create Runway from hash

-
@param rwy Hash containing runway data as returned from

-
airportinfo().runways[ <runway designator> ]

-
-

canvas.Runway.pointOffCenterline ( pos, off = 0 )

-
Get a point on the runway with the given offset

-
@param pos Position along the center line

-
@param off Offset perpendicular to the center line

-
-

canvas.make ( return )

-
-

canvas.LayerModel.new ( make )

-
-

canvas.LayerModel.clear ( me._elements = )

-
-

canvas.LayerModel.push ( e )

-
-

canvas.LayerModel.get ( me._elements )

-
-

canvas.LayerModel.update ( )

-
-

canvas.LayerModel.hasData ( size )

-
-

canvas.LayerModel.setView ( v )

-
-

canvas.LayerModel.setController ( c )

-
-

canvas.Layer

-
A layer is mapped to a canvas group

-
Layers are linked to a single boolean property to toggle them on/off

-
FIXME: this is GUI specific ATM

-
-

canvas.Layer.new ( group, name, model, controller=nil )

-
-

canvas.Layer.hide ( me._view.setVisible )

-
-

canvas.Layer.show ( me._view.setVisible )

-
-

canvas.Layer.toggle ( )

-
TODO: Unify toggle and update methods - and support lazy drawing (make it optional!)

-
-

canvas.Layer.reset ( )

-
-

canvas.Layer.update ( )

-
TODO: Unify toggle and update FIXME: GUI specific, not needed for 744 ND.nas

-
-

canvas.Layer.setDraw ( callback )

-
-

canvas.Layer.setController ( c )

-
-

canvas.Layer.setModel ( m )

-
-

canvas.LayeredMap

-
A layered map consists of several layers

-
TODO: Support nested LayeredMaps, where a LayeredMap may contain other LayeredMaps

-
TODO: use MapBehavior here and move the zoom/refpos methods there, so that map behavior can be easily customized

-
-

canvas.LayeredMap.new ( parent, name )

-
-

canvas.LayeredMap.listen ( p,c )

-
-

canvas.LayeredMap.initializeLayers ( )

-
-

canvas.LayeredMap.setRefPos ( lat, lon )

-
-

canvas.LayeredMap.setHdg ( hdg )

-
-

canvas.LayeredMap.updateZoom ( )

-
-

canvas.LayeredMap.updateState ( )

-
this is a huge hack at the moment, we need to encapsulate the setRefPos/setHdg methods, so that they are exposed to XML space

-
-

canvas.LayeredMap.setupZoom ( dialog )

-
TODO: this is currently GUI specific and not re-usable for instruments

-
-

canvas.LayeredMap.setZoom ( )

-
-

canvas.LayeredMap.resetLayers ( )

-
-

canvas.LayeredMap.cleanup_listeners ( )

-
FIXME: listener management should be done at the MVC level, for each component - not as part of the LayeredMap!

-
-

canvas.GenericMap

-
-

canvas.GenericMap.new ( parent, name )

-
-

canvas.GenericMap.setupLayer ( layer, property )

-
-

canvas.GenericMap.setupFeature ( layer, property, init )

-
features are layers - so this will do layer setup and then register listeners for each layer

-
-

canvas.GenericMap.pickupFeatures ( DIALOG_CANVAS )

-
This will read in the config and procedurally instantiate all requested layers and link them to toggle properties

-
FIXME: this is currently GUI specific and doesn't yet support instrument use, i.e. needs to be generalized further

-
-

canvas.GenericMap.setupGUI ( dialog, group )

-
NOT a method, cmdarg() is no longer meaningful when the canvas nasal block is executed

-
so this needs to be called in the dialog's OPEN block instead - TODO: generalize

-
FIXME: move somewhere else, this really is a GUI helper and should probably be generalized and moved to gui.nas

-
-

canvas.LayerModel.notifyView ( )

-
this is currently "directly" invoked via a listener, needs to be changed

-
to use the controller object instead

-
TODO: adopt real MVC here

-
FIXME: this must currently be explicitly called by the model, we need to use a wrapper to call it automatically instead!

-
-

canvas.MAP_LAYERS

-
-

canvas.register_layer ( name, layer )

-
-

canvas.load_modules ( vec, ns= )

-
-

canvas.files_with ( ext )

-
read in the file names dynamically: *.draw, *.model, *.layer

-
-

canvas.RouteDriver

-
-

canvas.RouteDriver.new ( )

-
-

canvas.RouteDriver.init ( )

-
-

canvas.RouteDriver.update ( )

-
-

canvas.RouteDriver.getNumberOfFlightPlans ( )

-
-

canvas.RouteDriver.getFlightPlanType ( fpNum )

-
-

canvas.RouteDriver.getFlightPlan ( fpNum )

-
-

canvas.RouteDriver.getPlanSize ( fpNum )

-
-

canvas.RouteDriver.getWP ( fpNum, idx )

-
-

canvas.RouteDriver.getPlanModeWP ( plan_wp_idx )

-
-

canvas.RouteDriver.hasDiscontinuity ( fpNum, wptID )

-
-

canvas.RouteDriver.getListeners ( )

-
-

canvas.RouteDriver.shouldUpdate ( 1 - )

-
-

canvas.MultiRouteDriver

-
-

canvas.MultiRouteDriver.new ( )

-
-

canvas.MultiRouteDriver.addFlightPlan ( type, plan )

-
-

canvas.MultiRouteDriver.removeFlightPlanAtIndex ( idx )

-
-

canvas.MultiRouteDriver.removeFlightPlanOfType ( type )

-
-

canvas.MultiRouteDriver.getNumberOfFlightPlans ( )

-
-

canvas.MultiRouteDriver.getFlightPlanType ( fpNum )

-
-

canvas.MultiRouteDriver.getFlightPlan ( fpNum )

-
-

canvas.MultiRouteDriver.getPlanSize ( fpNum )

-
-

canvas.MultiRouteDriver.getWP ( fpNum, idx )

-
-

canvas.MultiRouteDriver.getPlanModeWP ( idx )

-
-

canvas.MultiRouteDriver.triggerSignal ( signal )

-
-

canvas.MultiRouteDriver.signalPath ( signal )

-
-

canvas.MultiRouteDriver.getListeners ( )

-
-

canvas.makedie ( prefix )

-
-

canvas.try_aux_method ( obj, method_name )

-
Try to call a method on an object with no arguments. Should

-
work for both ghosts and hashes; catches the error only when

-
the method doesn't exist -- errors raised during the call

-
are re-thrown.

-
-

canvas.default_hash ( opt, df )

-
Combine a specific hash with a default hash, e.g. for

-
options/df_options and style/df_style in a SymbolLayer.

-
-

canvas.MapStructure_selfTest ( )

-
-

canvas.CachedElement

-
wrapper for each cached element: keeps the canvas and

-
texture map coordinates for the corresponding raster image.

-
-

canvas.CachedElement.new ( canvas_path, name, source, size, offset )

-
-

canvas.CachedElement.render ( group, trans0=0, trans1=0 )

-
-

canvas.SymbolCache

-
-

canvas.SymbolCache.new ( dim... )

-
-

canvas.SymbolCache.add ( name, callback, draw_mode=0 )

-
Add a cached symbol based on a drawing callback.

-
@note this assumes that the object added by callback

-
fits into the dimensions provided to the constructor,

-
and any larger dimensionalities are liable to be cut off.

-
-

canvas.SymbolCache.get ( name )

-
-

canvas.issym ( string )

-
-

canvas.internsymbol ( symbol )

-
-

canvas.tryintern ( symbol )

-
-

canvas.unescape ( s )

-
Helpers for below

-
-

canvas.hashdup ( _,rkeys=nil )

-
-

canvas.opt_member ( h,k )

-
-

canvas.member ( h,k )

-
-

canvas._in ( vec,k )

-
-

canvas.members ( h,vec=nil )

-
-

canvas.serialize ( m,others=nil )

-
-

canvas.call_draw ( draw, style, arg=nil, relevant_keys=nil )

-
Drawing functions have the form:

-
func(group) { group.createChild(...).set<Option>(<option>); ... }

-
The style is passed as (essentially) their local namespace/variables,

-
while the group is a regular argument.

-
-

canvas.style_string ( style, relevant_keys=nil )

-
Serialize a style into a string.

-
-

canvas.StyleableCacheable

-
A class to mix styling and caching. Using the above helpers it

-
serializes style hashes.

-
-

canvas.StyleableCacheable.new ( name, draw_func, cache, draw_mode=0, relevant_keys=nil )

-
Construct an object.

-
@param name Prefix to use for entries in the cache

-
@param draw_func Function for the cache that will draw the

-
symbol onto a group using the style parameters.

-
@param cache The SymbolCache to use for these symbols.

-
@param draw_mode See SymbolCache

-
@param relevant_keys A list of keys for the style used by the

-
draw_func. Although it defaults to all

-
available keys, it is highly recommended

-
that it be specified.

-
-

canvas.StyleableCacheable.request ( style )

-
Note: configuration like active/inactive needs

-
to also use the passed style hash, unless it is

-
chosen not to cache symbols that are, e.g., active.

-
-

canvas.StyleableCacheable.render ( element, style )

-
-

canvas.StyleableCacheable.draw ( style,s1 )

-
-

canvas.Symbol

-
A base class for Symbols placed on a map.

-
Note: for the derived objects, the element is stored as obj.element.

-
This is also part of the object's parents vector, which allows

-
callers to use obj.setVisible() et al. However, for code that

-
manipulates the element's path (if it is a Canvas Path), it is best

-
to use obj.element.addSegmentGeo() et al. for consistency.

-
-

canvas.Symbol.add ( type, class )

-
-

canvas.Symbol.get ( type )

-
-

canvas.Symbol.new ( type, group, layer, arg... )

-
Calls corresonding symbol constructor

-
@param group Canvas.Group to place this on.

-
@param layer The SymbolLayer this is a child of.

-
-

canvas.Symbol._new ( m )

-
Private constructor:

-
-

canvas.Symbol.update ( )

-
Update the drawing of this object (position and others).

-
-

canvas.Symbol.draw ( )

-
-

canvas.Symbol.del ( )

-
-

canvas.Symbol.newText ( text=nil, color=nil )

-
Add a text element with styling

-
-

canvas.Symbol.formattedString ( frmt, model_props )

-
Helper method that can be used to create a formatted String using

-
values extracted from the current model.

-
SYNOPSIS:

-
symbol.formattedString(format, model_property_names)

-
Arguments:

-
- format: string

-
- model_property_names: a vector of strings representing the model

-
property names to be used as arguments

-
EXAMPLE:

-
var label = waypoint.formattedString('Waypoint %s: lat %.4f, lng %.4f', [model.id, model.lat, model.lon]);

-
-

canvas.Symbol.getOption ( name, default = nil )

-
Wrapper method for accessing options. It allows to pass a default value

-
if the requested option is not defined.

-
EXAMPLE:

-
var ok = (contains(me.options, 'enabled') ? me.options.enabled : 0);

-
var ok = me.getOption('enabled', 0);

-
-

canvas.Symbol.getStyle ( name, default = nil )

-
Wrapper method for accessing style. It allows to pass a default value

-
if the requested style is not defined.

-
It also automatically resolves style properties when they're defined as

-
functions, by calling the corresponding function using the 'me' context

-
EXAMPLE:

-
me.style = {

-
color: [1,1,1],

-
line_color: func(){

-
me.model.tuned ? [0,0,1] : [1,1,1]

-
}

-
}

-
var color = me.getStyle('color'); --> [1,1,1]

-
me.model.tuned = 1;

-
var line_color = me.getStyle('line_color'); --> [0,0,1]

-
var txt_color = me.getStyle('text_color', [1,1,1]); --> [1,1,1]

-
-

canvas.Symbol.getLabelFromModel ( default_val = nil )

-
-

canvas.Symbol.callback ( name, args... )

-
Executes callback function specified by the first argument with

-
variable arguments. The callback is executed within the 'me' context.

-
Callbacks must be defined inside the options hash.

-
EXAMPLE:

-
me.options = {

-
dump_callback: func(){

-
print('Waypoint '~ me.model.id);

-
}

-
}

-
me.callback('dump');

-
-

canvas.Symbol.add ( type, class )

-
-

canvas.Symbol.get ( type )

-
-

canvas.Symbol.new ( type, symbol, model, arg... )

-
Calls corresonding symbol controller constructor

-
@param model Model to control this object (position and other attributes).

-
-

canvas.Symbol.update ( symbol, model )

-
Non-static:

-
Update anything related to a particular model. Returns whether the object needs updating:

-
-

canvas.Symbol.del ( symbol, model )

-
Delete an object from this controller (or delete the controller itself):

-
-

canvas.Symbol.isVisible ( model )

-
Return whether this model/symbol is (should be) visible:

-
-

canvas.Symbol.getpos ( model )

-
Get the position of this symbol/object:

-
-

canvas.getpos_fromghost ( positioned_g )

-
-

canvas.is_positioned_ghost ( obj )

-
-

canvas.register_supported_ghost ( name )

-
-

canvas.assert_m ( hash, member )

-
-

canvas.assert_ms ( hash, members... )

-
-

canvas.DotSym

-
Implementation for a particular type of symbol (for the *.symbol files)

-
to handle details.

-
-

canvas.DotSym.makeinstance ( name, hash )

-
Static/singleton:

-
-

canvas.DotSym.new ( group, layer, model, controller=nil )

-
For the instances returned from makeinstance:

-
@param group The Canvas.Group to add this to.

-
@param layer The SymbolLayer this is a child of.

-
@param model A correct object (e.g. positioned ghost) as

-
expected by the .draw file that represents

-
metadata like position, speed, etc.

-
@param controller Optional controller "glue". Each method

-
is called with the model as the only argument.

-
-

canvas.DotSym.del ( )

-
-

canvas.DotSym.init ( )

-
Default wrappers:

-
-

canvas.DotSym.deinit ( )

-
-

canvas.DotSym.update ( )

-
-

canvas.SVGSymbol

-
Small wrapper for DotSym: parse a SVG on init().

-
-

canvas.SVGSymbol.init ( )

-
-

canvas.SVGSymbol.draw ( )

-
-

canvas.RasterSymbol

-
wrapper for symbols based on raster images (i.e. PNGs)

-
TODO: generalize this and port WXR.symbol accordingly

-
-

canvas.RasterSymbol.init ( )

-
-

canvas.RasterSymbol.draw ( , - )

-
-

canvas.LineSymbol

-
-

canvas.LineSymbol.makeinstance ( name, hash )

-
Static/singleton:

-
-

canvas.LineSymbol.new ( group, layer, model, controller=nil )

-
For the instances returned from makeinstance:

-
-

canvas.LineSymbol.draw ( )

-
Non-static:

-
-

canvas.LineSymbol.del ( )

-
-

canvas.LineSymbol.init ( )

-
Default wrappers:

-
-

canvas.LineSymbol.deinit ( )

-
-

canvas.LineSymbol.update ( )

-
-

canvas.SymbolLayer

-
Base class for a SymbolLayer, e.g. MultiSymbolLayer or SingleSymbolLayer.

-
-

canvas.SymbolLayer.add ( type, class )

-
-

canvas.SymbolLayer.get ( type )

-
-

canvas.SymbolLayer.new ( type, group, map, controller=nil, style=nil, options=nil, visible=1, arg... )

-
Calls corresonding layer constructor

-
@param group Canvas.Group to place this on.

-
@param map The Canvas.Map this is a member of.

-
@param controller A controller object.

-
@param style An alternate style.

-
@param options Extra options/configurations.

-
@param visible Initially set it up as visible or invisible.

-
-

canvas.SymbolLayer._new ( m, style, controller, options )

-
Private constructor:

-
-

canvas.SymbolLayer.del ( )

-
For instances:

-
-

canvas.SymbolLayer.update ( )

-
-

canvas.SymbolLayer.add ( type, class )

-
-

canvas.SymbolLayer.get ( type )

-
-

canvas.SymbolLayer.new ( type, layer, arg... )

-
Calls corresonding controller constructor

-
@param layer The SymbolLayer this controller is responsible for.

-
-

canvas.SymbolLayer.searchCmd ( )

-
Default implementations for derived classes:

-
@return List of positioned objects.

-
-

canvas.SymbolLayer.addVisibilityListener ( )

-
-

canvas.SymbolLayer.getModel ( me._model, )

-
Default implementations for derived objects:

-
For SingleSymbolLayer: retreive the model object

-
-

canvas.MultiSymbolLayer

-
A layer that manages a list of symbols (using delta positioned handling

-
with a searchCmd to retreive placements).

-
-

canvas.MultiSymbolLayer.new ( group, map, controller=nil, style=nil, options=nil, visible=1 )

-
Default implementations/values:

-
@param group A group to place this on.

-
@param map The Canvas.Map this is a member of.

-
@param controller A controller object (parents=[SymbolLayer.Controller])

-
or implementation (parents[0].parents=[SymbolLayer.Controller]).

-
@param style An alternate style.

-
@param options Extra options/configurations.

-
@param visible Initially set it up as visible or invisible.

-
-

canvas.MultiSymbolLayer.update ( )

-
-

canvas.MultiSymbolLayer.del ( )

-
-

canvas.MultiSymbolLayer.delsym ( model )

-
-

canvas.MultiSymbolLayer.searchCmd ( )

-
-

canvas.MultiSymbolLayer.onAdded ( model )

-
Adds a symbol.

-
-

canvas.MultiSymbolLayer.onRemoved ( model )

-
Removes a symbol.

-
-

canvas.NavaidSymbolLayer

-
A layer that manages a list of statically-positioned navaid symbols (using delta positioned handling

-
with a searchCmd to retrieve placements).

-
This is not yet supposed to work properly, it's just there to help get rid of all the identical boilerplate code

-
in lcontroller files, so needs some reviewing and customizing still

-
-

canvas.NavaidSymbolLayer.make ( query )

-
static generator/functor maker:

-
-

canvas.SingleSymbolLayer

-
-

canvas.SingleSymbolLayer.new ( group, map, controller=nil, style=nil, options=nil, visible=1 )

-
Default implementations/values:

-
@param group A group to place this on.

-
@param map The Canvas.Map this is a member of.

-
@param controller A controller object (parents=[SymbolLayer.Controller])

-
or implementation (parents[0].parents=[SymbolLayer.Controller]).

-
@param style An alternate style.

-
@param options Extra options/configurations.

-
@param visible Initially set it up as visible or invisible.

-
-

canvas.SingleSymbolLayer.update ( )

-
-

canvas.SingleSymbolLayer.del ( )

-
-

canvas.OverlayLayer

-
Base class for a OverlayLayer, e.g. a TileLayer

-
-

canvas.OverlayLayer.add ( type, class )

-
-

canvas.OverlayLayer.get ( type )

-
-

canvas.OverlayLayer.new ( type, group, map, controller=nil, style=nil, options=nil, visible=1, arg... )

-
Calls corresonding layer constructor

-
@param group Canvas.Group to place this on.

-
@param map The Canvas.Map this is a member of.

-
@param style An alternate style.

-
@param options Extra options/configurations.

-
@param visible Initially set it up as visible or invisible.

-
-

canvas.OverlayLayer._new ( m, style, controller, options )

-
Private constructor:

-
-

canvas.OverlayLayer.del ( )

-
For instances:

-
-

canvas.OverlayLayer.update ( )

-
-

canvas.TileLayer

-
-

canvas.TileLayer.new ( group, map, controller=nil, style=nil, options=nil, visible=1 )

-
Default implementations/values:

-
@param group A group to place this on.

-
@param map The Canvas.Map this is a member of.

-
@param controller A controller object (parents=[OverlayLayer.Controller])

-
or implementation (parents[0].parents=[OverlayLayer.Controller]).

-
@param style An alternate style.

-
@param options Extra options/configurations.

-
@param visible Initially set it up as visible or invisible.

-
-

canvas.TileLayer.updateLayer ( )

-
-

canvas.TileLayer.update ( )

-
-

canvas.TileLayer.del ( )

-
-

canvas.TileLayer.add ( type, class )

-
-

canvas.TileLayer.get ( type )

-
-

canvas.TileLayer.new ( type, layer, arg... )

-
Calls corresponding controller constructor

-
@param layer The OverlayLayer this controller is responsible for.

-
-

canvas.TileLayer.updateLayer ( )

-
Default implementations for derived classes:

-
@return List of positioned objects.

-
-

canvas.TileLayer.addVisibilityListener ( )

-
-

canvas.TileLayer.addRangeListener ( )

-
-

canvas.TileLayer.addScreenRangeListener ( )

-
-

canvas.MapStructure

-
-

canvas.MapStructure.loadFile ( file, name )

-
Generalized load methods used to load various symbols, layer controllers,...

-
-

canvas.load_MapStructure ( )

-
-

canvas.MapStructure.add ( type, class )

-
-

canvas.MapStructure.get ( type )

-
-

canvas.MapStructure.new ( type, map, arg... )

-
Calls corresonding controller constructor

-
@param map The SymbolMap this controller is responsible for.

-
-

canvas.MapStructure.get_position ( )

-
Default implementations:

-
-

canvas.MapStructure.query_range ( )

-
-

canvas.MapStructure.in_range ( lat, lon, alt=0 )

-
-

canvas.PropertyElement

-
PropertyElement

-
Baseclass for all property controlled elements/objects

-
-

canvas.PropertyElement.new ( node, id )

-
Constructor

-
@param node Node to be used for element or vector [parent, type] for

-
creation of a new node with name type and given parent

-
@param id ID/Name (Should be unique)

-
-

canvas.PropertyElement.del ( )

-
Destructor (has to be called manually!)

-
-

canvas.PropertyElement.set ( key, value )

-
-

canvas.PropertyElement.setBool ( key, value )

-
-

canvas.PropertyElement.setDouble ( key, value )

-
-

canvas.PropertyElement.setInt ( key, value )

-
-

canvas.PropertyElement.get ( key, default = nil )

-
-

canvas.PropertyElement.getBool ( key )

-
-

canvas.PropertyElement.update ( )

-
Trigger an update of the element

-
Elements are automatically updated once a frame, with a delay of one frame.

-
If you wan't to get an element updated in the current frame you have to use

-
this method.

-
-

canvas.parsesvg ( group, path, options = nil )

-
Parse an xml file into a canvas group element

-
@param group The canvas.Group instance to append the parsed elements to

-
@param path The path of the svg file (absolute or relative to FG_ROOT)

-
@param options Optional hash of options

-
font-mapper func

-
parse_images bool

-
-

canvas.Tooltip

-
-

canvas.Tooltip.new ( size, id = nil )

-
Constructor

-
@param size ([width, height])

-
-

canvas.Tooltip.del ( )

-
Destructor

-
-

canvas.Tooltip.createCanvas ( )

-
Create the canvas to be used for this Tooltip

-
@return The new canvas

-
-

canvas.Tooltip.setLabel ( msg )

-
-

canvas.Tooltip.setProperty ( prop )

-
-

canvas.Tooltip.setWidthText ( txt )

-
specify a string used to compute the width of the tooltip

-
-

canvas.Tooltip._updateText ( )

-
-

canvas.Tooltip._updateBounds ( )

-
-

canvas.Tooltip._remapValue ( val )

-
-

canvas.Tooltip.setMapping ( mapping, f = nil )

-
-

canvas.Tooltip.setTooltipId ( tipId )

-
-

canvas.Tooltip.getTooltipId ( )

-
-

canvas.Tooltip.getCanvas ( )

-
Get the displayed canvas

-
-

canvas.Tooltip.setPosition ( x, y )

-
-

canvas.Tooltip.isMessage ( )

-
-

canvas.Tooltip.show ( )

-
-

canvas.Tooltip.showMessage ( timeout = nil, node = nil )

-
-

canvas.Tooltip._haveNode ( node, key )

-
-

canvas.Tooltip.hide ( )

-
-

canvas.Tooltip.hideNow ( )

-
-

canvas.Tooltip.isVisible ( )

-
-

canvas.Tooltip.fadeIn ( )

-
-

canvas.Tooltip.fadeOut ( )

-
-

canvas.Tooltip._hideTimeout ( )

-
private:

-
-

canvas.innerSetTooltip ( node )

-
-

canvas.setTooltip ( node )

-
-

canvas.showTooltip ( node )

-
-

canvas.updateHover ( node )

-
-

canvas.showMessage ( node )

-
-

canvas.clearMessage ( node )

-
-
-

console

-

console.REPL

-
-

console.REPL.new ( placement, name= )

-
-

console.REPL.execute ( )

-
-

console.REPL._is_str_char ( char )

-
-

console.REPL._handle_level ( level, str, line_number )

-
-

console.REPL.get_input ( )

-
-

console.CanvasPlacement

-
-

console.CanvasPlacement.new ( name= )

-
-

console.CanvasPlacement.del ( )

-
-

console.CanvasPlacement.add_char ( char, reset_view=0 )

-
-

console.CanvasPlacement.add_text ( text, reset_view=0 )

-
-

console.CanvasPlacement.remove_char ( reset_view=0 )

-
-

console.CanvasPlacement.clear_input ( reset_view=0 )

-
-

console.CanvasPlacement.replace_line ( replacement, replace_input=1, reset_view=0 )

-
-

console.CanvasPlacement.add_line ( text, reset_text=1, reset_view=0 )

-
-

console.CanvasPlacement.new_prompt ( )

-
-

console.CanvasPlacement.continue_line ( reset_text=1 )

-
-

console.CanvasPlacement.reset_input_from_history ( reset_view=0 )

-
-

console.CanvasPlacement.reset_view ( )

-
-

console.CanvasPlacement.set_line_color ( color )

-
-

console.CanvasPlacement.set_line_font ( font )

-
-

console.CanvasPlacement.clear ( )

-
-

console.CanvasPlacement.create_msg ( )

-
-

console.CanvasPlacement.create_line ( reset_text=1 )

-
-

console.CanvasPlacement.update ( )

-
-

console.CanvasPlacement.handle_key ( key, modifiers, keyCode )

-
-

console.CanvasPlacement.get_line ( )

-
-

console.CanvasPlacement.display_result ( res=nil )

-
-

console.CanvasPlacement.handle_runtime_error ( err )

-
-

console.CanvasPlacement.handle_parse_error ( msg, file, line )

-
-

console.CanvasPlacement.gettranslation ( k )

-
-

console.print2 ( i )

-
-
-

input_helpers

-

input_helpers.formatFrequencyMHz ( freqMhz, fieldWidth )

-
-

input_helpers.formatFrequencyKHz ( freqKhz, fieldWidth )

-
-

input_helpers.bytesForString ( s, fieldWidth )

-
-

input_helpers.translateTo14Segment

-
-

input_helpers.formatFourteenSegment ( s, fieldWidth )

-
-

input_helpers.reverseBytes ( bytes )

-
-

input_helpers.MFRController

-
-

input_helpers.MFRController.new ( prefix )

-
-

input_helpers.mcp

-
-

input_helpers.mcp.init ( )

-
-

input_helpers.mcp.setAltitudeFtProp ( path )

-
-

input_helpers.mcp.doRefresh ( )

-
-

input_helpers.mcp.doRefreshHeading ( )

-
-

input_helpers.mcp.setMachMode ( useMach )

-
-

input_helpers.mcp.altitudeData ( )

-
-

input_helpers.mcp.vsData ( )

-
-

input_helpers.mcp.speedData ( )

-
-

input_helpers.mcp.adjustSpeed ( val )

-
-

input_helpers.mcp.adjustAltitude ( val )

-
-

input_helpers.mcp.headingData ( )

-
-

input_helpers.mcp.course1Data ( )

-
-

input_helpers.mcp.course2Data ( )

-
-

input_helpers.mcp.watchPropertyForLED ( prop, ledName )

-
-

input_helpers.mcp.setLED ( data, b )

-
-
-

jetways

-

jetways.print_debug ( msg )

-
prints debug messages

-
-

jetways.print_error ( msg )

-
prints error messages

-
-

jetways.alert ( msg )

-
alerts the user

-
-

jetways.normdeg ( x )

-
normalizes headings between -180 and 180

-
-

jetways.remove ( vector, item )

-
deletes an item in a vector

-
-

jetways.isin ( vector, v )

-
checks if an item is in a vector

-
-

jetways.putmodel ( path, lat, lon, alt, hdg )

-
adds a model

-
-

jetways.interpolate_table ( table, v )

-
interpolates a value

-
-

jetways.get_relative_filepath ( path, target )

-
gets a relative file path

-
-

jetways.find_airports ( max_distance )

-
gets a list of nearest airports

-
TODO: Don't use /sim/airport/nearest-airport-id, which restricts the list to 1 airport

-
-

jetways.loadids

-
-

jetways.loadids.new ( airport, model, gate, door, airline, lat, lon, alt, heading, init_extend = 0, init_heading = 0, init_pitch = 0, init_ent_heading = 0 )

-
-

jetways.loadids.toggle ( user, heading, coord, hood = 0 )

-
-

jetways.loadids.extend ( user, heading, door_coord, hood = 0 )

-
-

jetways.loadids.retract ( user )

-
-

jetways.loadids.remove ( )

-
-

jetways.loadids.reload ( )

-
-

jetways.loadids.setpos ( lat, lon, hdg, alt )

-
-

jetways.loadids.setmodel ( model, airline, gate )

-
-

jetways.dialog ( )

-
-

jetways.toggle_jetway ( n )

-
-

jetways.toggle_jetway_from_coord ( door, hood, heading, lat, lon = nil )

-
-

jetways.toggle_jetway_from_model ( model )

-
-

jetways.load_airport_jetways ( airport )

-
loads jetways at an airport

-
-

jetways.unload_airport_jetways ( airport )

-
unloads jetways at an airport

-
-

jetways.restart ( )

-
restarts the main update loop

-
-

jetways.update_jetways ( loopid )

-
main update loop (runs when jetways are enable and actived)

-
-

jetways.load_jetways ( loopid )

-
loading/unloading loop (runs continuously)

-
-
-

jetways_edit

-

jetways_edit.click ( pos )

-
-

jetways_edit.delete ( )

-
-

jetways_edit.adjust ( name, value )

-
-

jetways_edit.export ( )

-
-

jetways_edit.convert_stg ( )

-
-

jetways_edit.convert_stg2 ( n )

-
-

jetways_edit.flash ( jetway )

-
-

jetways_edit.dialog ( )

-
-

jetways_edit.print_help ( )

-
-
-

local_weather

-

local_weather.select_cloud_model ( type, subtype )

-
-

local_weather.cloudAssembly

-
-

local_weather.create_undulatus ( type, blat, blong, balt, alt_var, nx, xoffset, edgex, x_var, ny, yoffset, edgey, y_var, und_strength, direction, tri )

-
-

local_weather.create_adv_undulatus ( arg )

-
-

local_weather.sgn ( x )

-
-

local_weather.create_stick_bundle ( arg )

-
-

local_weather.create_domains ( arg )

-
-

local_weather.create_cumulus_alleys ( blat, blon, balt, alt_var, nx, xoffset, edgex, x_var, ny, yoffset, edgey, y_var, und_strength, direction, tri )

-
-

local_weather.create_developing_cumulus_alleys ( blat, blon, balt, alt_var, nx, xoffset, edgex, x_var, ny, yoffset, edgey, y_var, und_strength, direction, tri )

-
-

local_weather.create_layer ( type, blat, blon, balt, bthick, rx, ry, phi, density, edge, rainflag, rain_density )

-
-

local_weather.cumulus_exclusion_layer ( blat, blon, balt, n, size_x, size_y, alpha, s_min, s_max, n_ex, exlat, exlon, exrad )

-
-

local_weather.setDefaultCloudsOff ( )

-
-

local_weather.setVisibility ( vis )

-
-

local_weather.setVisibilitySmoothly ( vis )

-
-

local_weather.visibility_loop ( )

-
-

local_weather.setLift ( lift )

-
-

local_weather.setRain ( rain )

-
-

local_weather.setRainDropletSize ( size )

-
-

local_weather.setSnow ( snow )

-
-

local_weather.setSnowFlakeSize ( size )

-
-

local_weather.setTurbulence ( turbulence )

-
-

local_weather.setTemperature ( T )

-
-

local_weather.setPressure ( p )

-
-

local_weather.setDewpoint ( D )

-
-

local_weather.setLight ( s )

-
-

local_weather.setLightSmoothly ( s )

-
-

local_weather.light_loop ( )

-
-

local_weather.setScattering ( s )

-
-

local_weather.setOvercast ( o )

-
-

local_weather.setSkydomeShader ( r, m, d )

-
-

local_weather.setWind ( dir, speed )

-
-

local_weather.smoothDirection ( dir0, dir1, factor )

-
-

local_weather.setWindSmoothly ( dir, speed )

-
-

local_weather.create_cloud ( path, lat, long, alt, heading )

-
-

local_weather.create_impostor ( path, lat, long, alt, heading )

-
-

local_weather.place_model ( path, lat, lon, alt, heading, pitch, yaw )

-
-

local_weather.place_model_controlled ( string, path, lat, lon, alt, heading, pitch, roll )

-
-

local_weather.create_cloud_new ( c )

-
-

local_weather.create_cloud_array ( i, clouds_path, clouds_lat, clouds_lon, clouds_alt, clouds_orientation )

-
-

local_weather.create_new_cloud_array ( i, cloudArray )

-
-

local_weather.get_elevation ( lat, lon )

-
-

local_weather.get_elevation_array ( lat, lon )

-
-

local_weather.set_wxradarecho_storm ( lat, lon, base, top, radius, ref, turb, type )

-
-

local_weather.remove_wxradar_echos ( )

-
-

local_weather.features

-
-

local_weather.calc_geo ( clat )

-
-

local_weather.calc_d_sq ( lat1, lon1, lat2, lon2 )

-
-

local_weather.effect_volume_loop ( index, n_active )

-
-

local_weather.assemble_effect_array ( )

-
-

local_weather.add_vectors ( phi1, r1, phi2, r2 )

-
-

local_weather.wind_altitude_interpolation ( altitude, w )

-
-

local_weather.wind_interpolation ( lat, lon, alt )

-
-

local_weather.get_slowdown_fraction ( )

-
-

local_weather.interpolation_loop ( )

-
-

local_weather.thermal_lift_start ( ev )

-
-

local_weather.thermal_lift_loop ( )

-
-

local_weather.thermal_lift_stop ( )

-
-

local_weather.wave_lift_start ( ev )

-
-

local_weather.wave_lift_loop ( )

-
-

local_weather.wave_lift_stop ( )

-
-

local_weather.effect_volume_start ( ev )

-
-

local_weather.effect_volume_stop ( ev )

-
-

local_weather.ts_factor ( t, alt, height )

-
-

local_weather.tl_factor ( t, alt, height )

-
-

local_weather.calcLift_max ( alt, max_lift, height )

-
-

local_weather.calcLift ( d, alt, R, height, cn, sh, max_lift, f_lift_radius, t )

-
-

local_weather.calcWaveLift ( x,y, alt )

-
-

local_weather.create_cloud_vec ( path, lat, lon, alt, heading )

-
-

local_weather.clear_all ( )

-
-

local_weather.create_detailed_cumulus_cloud ( lat, lon, alt, size )

-
-

local_weather.create_cumulonimbus_cloud ( lat, lon, alt, size )

-
-

local_weather.create_cumulonimbus_cloud_rain ( lat, lon, alt, size, rain )

-
-

local_weather.create_cumosys ( blat, blon, balt, nc, size )

-
-

local_weather.cumulus_loop ( blat, blon, balt, nc, size )

-
-

local_weather.create_cumulus ( blat, blon, balt, nc, size )

-
-

local_weather.recreate_cumulus ( blat, blon, balt, alpha, nc, size, tile_index )

-
-

local_weather.create_rise_clouds ( blat, blon, balt, nc, size, winddir, dist )

-
-

local_weather.create_streak ( type, blat, blong, balt, alt_var, nx, xoffset, edgex, x_var, ny, yoffset, edgey, y_var, direction, tri )

-
-

local_weather.create_hollow_layer ( type, blat, blon, balt, bthick, rx, ry, phi, density, edge, gap_fraction )

-
-

local_weather.create_cloudbox ( type, blat, blon, balt, dx,dy,dz,n, f_core, r_core, h_core, n_core, f_bottom, h_bottom, n_bottom )

-
-

local_weather.terrain_presampling_start ( blat, blon, nc, size, alpha )

-
-

local_weather.terrain_presampling_loop ( blat, blon, nc, size, alpha )

-
-

local_weather.terrain_presampling ( blat, blon, ntries, size, alpha )

-
-

local_weather.terrain_presampling_analysis ( )

-
-

local_weather.wave_detection_loop ( blat, blon, nx, alpha )

-
-

local_weather.get_convective_altitude ( balt, elevation, tile_index, grad )

-
-

local_weather.get_terrain_gradient ( lat, lon, elevation1, phi, dist )

-
-

local_weather.get_gradient_factor ( grad )

-
-

local_weather.get_lee_bias ( grad, tile_index )

-
-

local_weather.get_terrain_altitude_factor ( tile_index, balt, elevation )

-
-

local_weather.get_terrain_strength_factor ( terrain_altitude_factor )

-
-

local_weather.manage_presampling ( )

-
-

local_weather.manage_hardcoded_presampling ( )

-
-

local_weather.set_wind_model_flag ( )

-
-

local_weather.set_texture_mix ( )

-
-

local_weather.create_effect_volume ( geometry, lat, lon, r1, r2, phi, alt_low, alt_high, vis, rain, snow, turb, lift, lift_flag, sat )

-
-

local_weather.set_weather_station ( lat, lon, alt, vis, T, D, p )

-
-

local_weather.set_atmosphere_ipoint ( lat, lon, vis_aloft, vis_alt1, vis_ovcst, ovcst,ovcst_alt_low, ovcst_alt_high, scatt, scatt_alt_low, scatt_alt_high )

-
-

local_weather.set_wind_ipoint ( lat, lon, d0, v0, d1, v1, d2, v2, d3, v3, d4, v4, d5, v5, d6, v6, d7, v7, d8, v8 )

-
-

local_weather.set_wind_ipoint_metar ( lat, lon, d0, v0 )

-
-

local_weather.showDialog ( name )

-
-

local_weather.readFlags ( )

-
-

local_weather.streak_wrapper ( )

-
-

local_weather.convection_wrapper ( )

-
-

local_weather.barrier_wrapper ( )

-
-

local_weather.single_cloud_wrapper ( )

-
-

local_weather.layer_wrapper ( )

-
-

local_weather.box_wrapper ( )

-
-

local_weather.set_aloft_wrapper ( )

-
-

local_weather.set_tile ( )

-
-

local_weather.startup ( )

-
-

local_weather.test ( )

-
-

local_weather.weatherStation

-
-

local_weather.weatherStation.new ( lat, lon, alt, vis, T, D, p )

-
-

local_weather.weatherStation.move ( )

-
-

local_weather.atmosphereIpoint

-
-

local_weather.atmosphereIpoint.new ( lat, lon, vis_aloft, vis_alt1, vis_ovcst, ovcst, ovcst_alt_low, ovcst_alt_high, scatt, scatt_alt_low, scatt_alt_high )

-
-

local_weather.atmosphereIpoint.move ( )

-
-

local_weather.windIpoint

-
-

local_weather.windIpoint.new ( lat, lon, d0, v0, d1, v1, d2, v2, d3, v3, d4, v4, d5, v5, d6, v6, d7, v7, d8, v8 )

-
-

local_weather.windVec

-
-

local_weather.windVec.new ( d, v )

-
-

local_weather.effectVolume

-
-

local_weather.effectVolume.new ( geometry, lat, lon, r1, r2, phi, alt_low, alt_high, vis, rain, snow, turb, lift, lift_flag, sat )

-
-

local_weather.effectVolume.move ( )

-
-

local_weather.effectVolume.correct_altitude ( )

-
-

local_weather.effectVolume.correct_altitude_and_age ( )

-
-

local_weather.effectVolume.get_distance ( )

-
-

local_weather.thermalLift

-
-

local_weather.thermalLift.new ( lat, lon, radius, height, cn, sh, max_lift, f_lift_radius )

-
-

local_weather.thermalLift.move ( )

-
-

local_weather.thermalLift.correct_altitude ( )

-
-

local_weather.thermalLift.correct_altitude_and_age ( )

-
-

local_weather.waveLift

-
-

local_weather.waveLift.new ( lat, lon, x, y, phi, height, max_lift )

-
-

local_weather.thermal

-
-

local_weather.wave

-
-

local_weather.interpolated_conditions

-
-

local_weather.current_conditions

-
-

local_weather.tracerAssembly

-
-

local_weather.updateMenu ( )

-
-

local_weather.seaColorPoint

-
-

local_weather.seaColorPoint.new ( lat, lon, weight, deep_r, deep_g, deep_b )

-
-

local_weather.init_sea_colors ( )

-
-

local_weather.sea_color_loop ( index )

-
-

local_weather.get_windfield ( tile_index )

-
-

local_weather.get_wind_direction ( tile_index )

-
-

local_weather.get_wind_speed ( tile_index )

-
-

local_weather.timing_loop ( )

-
-

local_weather.quadtree_loop ( )

-
-

local_weather.weather_dynamics_loop ( index, cindex )

-
-

local_weather.convective_loop ( )

-
-

local_weather.generate_quadtree_structure ( depth, tree_base_vec )

-
-

local_weather.sort_into_quadtree ( blat, blon, alpha, lat, lon, tree, object )

-
-

local_weather.sorting_recursion ( x, y, tree, object, depth )

-
-

local_weather.quadtree_recursion ( tree, depth, flag, qx, qy )

-
-

local_weather.check_visibility ( qx,qy, length_scale )

-
-

local_weather.move_tile ( t )

-
-

local_weather.get_cartesian ( blat, blon, alpha, lat, lon )

-
-

local_weather.tile_start ( )

-
-

local_weather.tile_finished ( )

-
-

local_weather.set_4_8_stratus_tile ( )

-
-

local_weather.set_high_pressure_core_tile ( )

-
-

local_weather.set_high_pressure_tile ( )

-
-

local_weather.set_high_pressure_border_tile ( )

-
-

local_weather.set_low_pressure_border_tile ( )

-
-

local_weather.set_low_pressure_tile ( )

-
-

local_weather.set_low_pressure_core_tile ( )

-
-

local_weather.set_cold_sector_tile ( )

-
-

local_weather.set_warm_sector_tile ( )

-
-

local_weather.set_tropical_weather_tile ( )

-
-

local_weather.set_thunderstorms_tile ( )

-
-

local_weather.set_coldfront_tile ( )

-
-

local_weather.set_warmfront1_tile ( )

-
-

local_weather.set_warmfront2_tile ( )

-
-

local_weather.set_warmfront3_tile ( )

-
-

local_weather.set_warmfront4_tile ( )

-
-

local_weather.set_METAR_tile ( )

-
-

local_weather.set_METAR_weather_station ( )

-
-

local_weather.create_8_8_tstratus ( lat, lon, alt, alpha )

-
-

local_weather.create_8_8_cirrostratus ( lat, lon, alt, alpha )

-
-

local_weather.create_8_8_nimbus ( lat, lon, alt, alpha )

-
-

local_weather.create_8_8_nimbus_var1 ( lat, lon, alt, alpha )

-
-

local_weather.create_8_8_nimbus_var2 ( lat, lon, alt, alpha )

-
-

local_weather.create_8_8_nimbus_var3 ( lat, lon, alt, alpha )

-
-

local_weather.create_8_8_nimbus_rain ( lat, lon, alt, alpha, rain )

-
-

local_weather.create_8_8_stratus ( lat, lon, alt, alpha )

-
-

local_weather.create_8_8_stratus_rain ( lat, lon, alt, alpha, rain )

-
-

local_weather.create_6_8_stratus ( lat, lon, alt, alpha )

-
-

local_weather.create_6_8_nimbus_rain ( lat, lon, alt, alpha, rain )

-
-

local_weather.create_6_8_stratus_rain ( lat, lon, alt, alpha, rain )

-
-

local_weather.create_6_8_stratus_undulatus ( lat, lon, alt, alpha )

-
-

local_weather.create_6_8_tstratus_undulatus ( lat, lon, alt, alpha )

-
-

local_weather.create_6_8_tstratus_mackerel ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_6_8_cirrostratus ( lat, lon, alt, alpha )

-
-

local_weather.create_6_8_stratocumulus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_stratus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_stratus_patches ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_tstratus_patches ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_tstratus_domains ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_4_8_sstratus_patches ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_cirrostratus_patches ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_cirrostratus_undulatus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_stratus_undulatus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_tstratus_undulatus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_sstratus_undulatus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_cirrocumulus_bank ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_cirrocumulus_undulatus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_cirrocumulus_streaks ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_altocumulus_perlucidus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_alttstratus_streaks ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_alttstratus_patches ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_stratocumulus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_cumulus_alleys ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_small_cumulus_alleys ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_cirrus ( lat, lon, alt, alpha )

-
-

local_weather.create_4_8_sstratus_bundle ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_4_8_sstratus_domains ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_4_8_cirrus_bundle ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_4_8_alttstratus_domains ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_2_8_sstratus_bundle ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_2_8_sstratus_hires_bundle ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_2_8_cirrostratus_mackerel ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_2_8_perlucidus_mackerel ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_2_8_alttstratus_domains ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_2_8_altocumulus_domains ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_2_8_altocumulus_perlucidus_domains ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_2_8_cirrocumulus_domains ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_2_8_stratus ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_tstratus ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_sstratus ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_altocumulus_perlucidus ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_sstratus_streak ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_cirrostratus ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_cirrocumulus ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_cirrus ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_alttstratus ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_altocumulus_streaks ( lat, lon, alt, alpha )

-
-

local_weather.create_1_8_cirrocumulus_mackerel ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_1_8_alttstratus_domains ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_1_8_altocumulus_scattered ( lat, lon, alt, alpha )

-
-

local_weather.create_1_8_cirrocumulus ( lat, lon, alt, alpha )

-
-

local_weather.create_1_8_cirrus ( lat, lon, alt, alpha )

-
-

local_weather.create_1_8_cirrus_bundle ( lat, lon, alt, alpha )

-
-

local_weather.arg

-
-

local_weather.create_1_8_cirrostratus_undulatus ( lat, lon, alt, alpha )

-
-

local_weather.create_1_8_contrails ( lat, lon, alt, alpha )

-
-

local_weather.create_thunderstorm_scenario ( lat, lon, alt, alpha )

-
-

local_weather.create_stratocumulus_bank ( lat, lon, alt, alpha )

-
-

local_weather.create_detailed_stratocumulus_bank ( lat, lon, alt, alpha )

-
-

local_weather.create_detailed_small_stratocumulus_bank ( lat, lon, alt, alpha )

-
-

local_weather.create_cloud_bank ( type, lat, lon, alt, x1, x2, height, n, alpha )

-
-

local_weather.create_small_thunderstorm ( lat, lon, alt, alpha )

-
-

local_weather.create_medium_thunderstorm ( lat, lon, alt, alpha )

-
-

local_weather.create_big_thunderstorm ( lat, lon, alt, alpha )

-
-

local_weather.create_noctilucent_patch ( lat, lon, alt, alpha )

-
-

local_weather.create_2_8_cirrocumulus_patches ( lat, lon, alt, alpha )

-
-

local_weather.create_impostor_ring ( lat, lon, alt, alpha, type, n )

-
-

local_weather.calc_geo ( clat )

-
-

local_weather.get_lat ( x,y,phi )

-
-

local_weather.get_lon ( x,y,phi )

-
-

local_weather.get_n ( strength )

-
-

local_weather.adjust_p ( p )

-
-

local_weather.tile_management_loop ( )

-
-

local_weather.generate_tile ( code, lat, lon, dir_index )

-
-

local_weather.remove_tile ( index )

-
-

local_weather.change_active_tile ( index )

-
-

local_weather.rotate_tile_scheme ( angle )

-
-

local_weather.copy_entry ( from_index, to_index )

-
-

local_weather.create_neighbour ( blat, blon, index, alpha )

-
-

local_weather.create_neighbours ( blat, blon, alpha )

-
-

local_weather.housekeeping_loop ( index, index1 )

-
-

local_weather.remove_impostors ( )

-
-

local_weather.create_impostors ( )

-
-

local_weather.thunderstorm_management_loop ( )

-
-

local_weather.lightning_strike ( )

-
-

local_weather.shadow_management_loop ( index )

-
-

local_weather.watchdog_loop ( )

-
-

local_weather.cloudBuffer

-
-

local_weather.cloudBuffer.new ( lat, lon, alt, path, orientation, index, type )

-
-

local_weather.cloudBuffer.get_distance ( )

-
-

local_weather.cloudBuffer.get_course ( )

-
-

local_weather.cloudBuffer.show ( )

-
-

local_weather.cloudBuffer.move ( )

-
-

local_weather.cloudImpostor

-
-

local_weather.cloudImpostor.new ( modelNode )

-
-

local_weather.cloudImpostor.removeNodes ( )

-
-

local_weather.cloudShadow

-
-

local_weather.cloudShadow.new ( lat, lon, size, strength )

-
-

local_weather.thunderstormHash

-
-

local_weather.thunderstormHash.new ( lat, lon, alt, size, strength )

-
-

local_weather.cloudScenery

-
-

local_weather.cloudScenery.new ( index, type, cloudNode, modelNode )

-
-

local_weather.cloudScenery.removeNodes ( )

-
-

local_weather.cloudScenery.to_buffer ( )

-
-

local_weather.cloudScenery.get_distance ( )

-
-

local_weather.cloudScenery.get_course ( )

-
-

local_weather.cloudScenery.get_altitude ( )

-
-

local_weather.cloudScenery.correct_altitude ( )

-
-

local_weather.cloudScenery.correct_altitude_and_age ( )

-
-

local_weather.cloudScenery.to_target_alt ( )

-
-

local_weather.cloudScenery.move ( )

-
-

local_weather.cloudScenery.show ( )

-
-

local_weather.cloud

-
-

local_weather.cloud.new ( type, subtype )

-
-

local_weather.cloud.remove ( )

-
-

local_weather.cloud.move ( )

-
-

local_weather.cloud.correct_altitude ( )

-
-

local_weather.calc_geo ( clat )

-
-

local_weather.get_lat ( x,y,phi )

-
-

local_weather.get_lon ( x,y,phi )

-
-

local_weather.relangle ( alpha, beta )

-
-

local_weather.norm_relangle ( alpha, beta )

-
-

local_weather.delete_from_vector ( vec, index )

-
-
-

performance_monitor

-

performance_monitor.dialog

-
-

performance_monitor.dialog.init ( x = nil, y = nil )

-
-

performance_monitor.dialog.create ( )

-
-

performance_monitor.dialog.update ( id )

-
-

performance_monitor.dialog._redraw_ ( )

-
-

performance_monitor.dialog.close ( )

-
-

performance_monitor.dialog.del ( )

-
-

performance_monitor.dialog.show ( )

-
-

performance_monitor.dialog.toggle ( )

-
-
-

std

-

std.string

-
-

std.string.new ( str )

-
public:

-
-

std.string.compare ( )

-
compare(s)

-
compare(pos, n, s)

-
@param s String to compare to

-
@param pos Position of first character used to compare

-
@param n Number of characters to compare

-
-

std.string.find_first_of ( s, pos = 0 )

-
-

std.string.find ( s, pos = 0 )

-
-

std.string.find_first_not_of ( s, pos = 0 )

-
-

std.string.substr ( pos, len = nil )

-
-

std.string.starts_with ( s )

-
-

std.string.size ( )

-
-

std.string._eq ( pos, s )

-
private:

-
-

std.string._find ( first, last, s, eq )

-
-

std.stoul ( str, base = 10 )

-
converts a string to an unsigned integer

-
-

std.min ( a, b )

-
-

std.max ( a, b )

-
-

std.Vector

-
-

std.Vector.new ( vector=nil )

-
-

std.Vector.size ( )

-
-

std.Vector.clear ( )

-
-

std.Vector.append ( item )

-
-

std.Vector.extend ( other_vector )

-
-

std.Vector.insert ( index, item )

-
-

std.Vector.pop ( index=nil )

-
-

std.Vector.index ( item )

-
-

std.Vector.contains ( item )

-
-

std.Vector.remove ( item )

-
-
-

towing

-

towing.towing ( )

-
-

towing.findBestAIObject ( )

-
-

towing.aerotow ( open )

-
-

towing.winch ( open )

-
-

towing.createTowrope ( device )

-
-

towing.getFreeModelID ( )

-
-

towing.closeHitch ( )

-
-

towing.releaseHitch ( device )

-
-

towing.removeTowrope ( device )

-
-

towing.pull_in_rope ( )

-
-

towing.setAIObjectDefaults ( )

-
-

towing.setWinchPositionAuto ( )

-
-

towing.runWinch ( )

-
-

towing.releaseWinch ( )

-
-

towing.assignHitchLocations ( device )

-
-

towing.PointRotate3D ( x,y,z,xr,yr,zr,alpha_deg,beta_deg,gamma_deg )

-
-
-

tutorial

-

tutorial.startTutorial ( )

-
-

tutorial.stopTutorial ( )

-
-

tutorial.step_tutorial ( id )

-
- Gets the current step node from the tutorial

-
- If this is the first time the step is entered, it displays the instruction message

-
- Otherwise, it

-
- Checks if the exit conditions have been met. If so, it increments the step counter.

-
- Checks for any error conditions, in which case it displays a message to the screen and

-
increments an error counter

-
- Otherwise display the instructions for the step.

-
-

tutorial.do_group ( node, default_msg = nil )

-
Do the stuff that's shared by <init>, <step>, <error>, <exit>, and <abort>.

-
<end> doesn't use it.

-
-

tutorial.read_int ( node, child, default )

-
-

tutorial.set_properties ( node )

-
scan all <set> blocks and set their <property> to <value> or

-
the value of a property that <property n="1"> points to

-
<set>

-
<property>/foo/bar</property>

-
<value>woof</value>

-
</set>

-
-

tutorial.set_targets ( node )

-
For each <target><*><longitude-deg|latitude-deg> calculate and update

-
/sim/tutorials/targets/*/...

-
heading-deg ... absolute heading to target (0 -> North)

-
direction-deg ... relative angle to target (0 -> ahead, 90 -> to the right)

-
distance-m ... distance in meters

-
eta-min ... estimated time of arrival (assuming aircraft flies in

-
in current speed towards target)

-
-

tutorial.set_models ( node )

-
-

tutorial.remove_models ( )

-
-

tutorial.set_view ( node = nil )

-
-

tutorial.set_marker ( node = nil )

-
-

tutorial.is_running ( which = nil )

-
Set and return running state. Disable/enable stop menu.

-
-

tutorial.say_message ( node, default = nil )

-
-

tutorial.shuffle ( vec )

-
-

tutorial.run_nasal ( node )

-
-

tutorial.say ( what, who = )

-
-

tutorial.init_nasal ( )

-
Set up namespace "__tutorial" for embedded Nasal.

-
-

tutorial.dialog ( )

-
-

tutorial.load ( file, index = 0 )

-
Tutorial loader for development purposes.

-
Usage: tutorial.load("Aircraft/bo105/Tutorials/foo.xml", 1)

-
- \ No newline at end of file diff --git a/download-latest-fgdata.bat b/download-latest-fgdata.bat new file mode 100644 index 0000000..372bf2e --- /dev/null +++ b/download-latest-fgdata.bat @@ -0,0 +1,19 @@ +REM This Windows script downloads latest files from GitLab: Nasal folder, and the version file. + +@echo off + +if exist FGROOT ( + rmdir /S /Q FGROOT +) + +mkdir FGROOT +cd FGROOT || exit /b + +git clone --filter=blob:none --depth 1 --no-checkout https://gitlab.com/flightgear/fgdata.git FGDATA +cd FGDATA || exit /b + +git sparse-checkout init --no-cone +git sparse-checkout set /Nasal /version +git checkout next + +rmdir /S /Q .git diff --git a/download-latest-fgdata.sh b/download-latest-fgdata.sh new file mode 100644 index 0000000..d480f8f --- /dev/null +++ b/download-latest-fgdata.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# This Linux script downloads latest files from GitLab: Nasal folder, and the version file. + +if [ -d "FGROOT" ]; then + rm -rf FGROOT +fi + +mkdir FGROOT +cd FGROOT || exit + +git clone --filter=blob:none --depth 1 --no-checkout https://gitlab.com/flightgear/fgdata.git FGDATA +cd FGDATA || exit + +git sparse-checkout init --no-cone +git sparse-checkout set /Nasal /version +git checkout next + +rm -rf .git diff --git a/nasal_api_doc.py b/nasal_api_doc.py deleted file mode 100644 index 777e014..0000000 --- a/nasal_api_doc.py +++ /dev/null @@ -1,324 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Copyright (C) 2012 Adrian Musceac -# Copyright (C) 2019-2025 RenanMsV -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -"""Script which generates an API documentation file for Nasal libraries -located inside $FGROOT/Nasal/""" - -import os -import sys -import re -import time -import argparse -import glob - -########### Local $FGROOT/Nasal/ path ########## -NASAL_PATH="../fgfs/fgdata/Nasal/" -OUTPUT_PATH="./out" - -def get_files(nasal_dir): - ''' Scans for all nasal files and generates documents ''' - if nasal_dir[-1]!='/': - nasal_dir+='/' - try: - os.stat(nasal_dir) - except FileNotFoundError: - print("The path does not exist:", nasal_dir) - sys.exit(1) - fgroot_dir = nasal_dir.rstrip('/').replace('Nasal','') - f_version = open(fgroot_dir+'version','r',encoding='utf-8') - version = f_version.read(256).rstrip('\n') - top_level = [] - modules = [] - top_namespaces = [] - files_list = os.listdir(nasal_dir) - for f in files_list: - if f.find(".nas")!=-1: - top_level.append(f) - continue - if os.path.isdir(nasal_dir + f): - modules.append(f) - top_level.sort() - modules.sort() - if len(top_level) ==0: - print("This does not look like the correct $FGROOT/Nasal path") - sys.exit() - if len(modules)==0: - print("Warning: could not find any submodules") - for f in top_level: - namespace=f.replace(".nas","") - functions=parse_file(nasal_dir + f) - top_namespaces.append([namespace,functions]) - for m in modules: - files=glob.glob(nasal_dir+m+"/*.nas") - for f in files: - functions=parse_file(f) - top_namespaces.append([m,functions]) - - output_text(top_namespaces,modules,version) - - -def output_text(top_namespaces,modules,version): - ''' Ouputs the text, namespaces, modules to html files ''' - try: - if not os.path.exists(OUTPUT_PATH): - os.mkdir(OUTPUT_PATH) - except NotADirectoryError as e: - print("Could not create output directory:", OUTPUT_PATH, e) - sys.exit(1) - timestring = time.strftime("%m-%d-%Y %I-%M-%S%p") - fw=open(OUTPUT_PATH + 'nasal_api_doc-' + version + '.html','wb') - buf='\ - Nasal API - ' + version + '\ - \n\ - ' - - buf+='

\ - Nasal $FGROOT Library
Flightgear version: '+version+'\ -
This file is generated automatically by nasal_api_doc.py at ' + timestring + '\ -

\ -
Nasal documentation\ - [mirror]  \ - Flightgear Nasal documentation\n
 ' - buf+='

\n' - done=[] - for namespace in top_namespaces: - color='0000cc' - if namespace[0] in modules: - color='cc0000' - if namespace[0] not in done: - buf+=''+namespace[0]+' 
\n' - done.append(namespace[0]) - buf+='

\n' - done2=[] - for namespace in top_namespaces: - if namespace[0] not in done2: - buf+='
\n' - buf += '

'+namespace[0]+'

\n' - done2.append(namespace[0]) - for functions in namespace[1]: - class_func=functions[0].split('.') - if len(class_func)>1: - f_name='' - if class_func[1].find('_')==0: - f_name=''+class_func[1]+'' - else: - f_name=class_func[1] - if class_func[1]!='': - buf+= '

'\ - +namespace[0]+''+ "." + ''+class_func[0]+''+'.'+f_name+''+' ( '+ functions[1]+ ' )' +'

\n' - else: - buf+= '

'\ - +namespace[0]+''+ "." + ''+class_func[0]+'' +'

\n' - else: - if functions[0].find('_')==0: - f_name=''+functions[0]+'' - else: - f_name=functions[0] - buf+= '

'\ - +namespace[0]+''+ "." + ''+f_name+''+ ' ( '+ functions[1]+ ' )' +'

\n' - for comment in functions[2]: - if comment.find('=====')!=-1: - buf+='
' - else: - tempComment = comment.replace('#','').replace('<','<').replace('>','>') - if tempComment.strip()!="": - buf+= '
'+tempComment+'

\n' - buf+='
\n' - if namespace[0] not in done2: - buf+='
\n' - buf+='' - fw.write(buf.encode('utf8')) - fw.close() - print("Generated file", fw.name) - - -def parse_file(filename): - ''' Parses a nasal file to search for keywords and docstrings ''' - fr=open(filename,'r', encoding='utf-8') - content=fr.readlines() - i=0 - retval=[] - classname="" - for line in content: - match=re.search(r'^var\s+([A-Za-z0-9_-]+)\s*=\s*func\s*\(?([A-Za-z0-9_\s,=.\n-]*)\)?',line) - if match is not None: - func_name=match.group(1) - comments=[] - param=match.group(2) - if(line.find(')')==-1 and line.find('(')!=-1): - k=i+1 - while(content[k].find(')')==-1): - param+=content[k].rstrip('\n') - k+=1 - param+=content[k].split(')')[0] - j=i-1 - count=0 - while ( j>i-35 and j>-1): - if count>3: - break - if len(content[j])<2: - j-=1 - count+=1 - continue - if re.search(r'^\s*#',content[j]) is not None: - comments.append(content[j].rstrip('\n')) - j-=1 - else: - break - if(len(comments)>1): - comments.reverse() - retval.append((func_name, param,comments)) - i+=1 - continue - - match3=re.search(r'^var\s*([A-Za-z0-9_-]+)\s*=\s*{\s*(\n|})',line) - if match3 is not None: - classname=match3.group(1) - - comments=[] - - j=i-1 - count=0 - while ( j>i-35 and j>-1): - if count>3: - break - if len(content[j])<2: - j-=1 - count+=1 - continue - if re.search(r'^\s*#',content[j]) is not None: - comments.append(content[j].rstrip('\n')) - j-=1 - else: - break - if(len(comments)>1): - comments.reverse() - retval.append((classname+'.', '',comments)) - i+=1 - continue - - match2=re.search(r'^\s*([A-Za-z0-9_-]+)\s*:\s*func\s*\(?([A-Za-z0-9_\s,=.\n-]*)\)?',line) - if match2 is not None: - func_name=match2.group(1) - comments=[] - param=match2.group(2) - if(line.find(')')==-1 and line.find('(')!=-1): - k=i+1 - while(content[k].find(')')==-1): - param+=content[k].rstrip('\n') - k+=1 - param+=content[k].split(')')[0] - j=i-1 - count=0 - while ( j>i-35 and j>-1): - if count>3: - break - if len(content[j])<2: - j-=1 - count+=1 - continue - if re.search(r'^\s*#',content[j]) is not None: - comments.append(content[j].rstrip('\n')) - j-=1 - else: - break - if(len(comments)>1): - comments.reverse() - if classname =='': - continue - retval.append((classname+'.'+func_name, param,comments)) - i+=1 - continue - - match4=re.search(r'^([A-Za-z0-9_-]+)\.([A-Za-z0-9_-]+)\s*=\s*func\s*\(?([A-Za-z0-9_\s,=\n.-]*)\)?',line) - if match4 is not None: - classname=match4.group(1) - func_name=match4.group(2) - comments=[] - param=match4.group(3) - if(line.find(')')==-1 and line.find('(')!=-1): - k=i+1 - while(content[k].find(')')==-1): - param+=content[k].rstrip('\n') - k+=1 - param+=content[k].split(')')[0] - j=i-1 - count=0 - while ( j>i-35 and j>-1): - if count>3: - break - if len(content[j])<2: - j-=1 - count+=1 - continue - if re.search(r'^\s*#',content[j]) is not None: - comments.append(content[j].rstrip('\n')) - j-=1 - else: - break - if(len(comments)>1): - comments.reverse() - retval.append((classname+'.'+func_name, param,comments)) - i+=1 - continue - - i+=1 - return retval - - -if __name__ == "__main__": - parser = argparse.ArgumentParser( - description="Auto generates Nasal API documentation from FlightGear's nasal scripts." - ) - - parser.add_argument( - "-f", "--fg-root", - metavar="PATH", - help="The desired FlightGear data folder (defaults to ../fgfs/fgdata/Nasal/).", - default="../fgfs/fgdata/Nasal/", - ) - - parser.add_argument( - "-o", "--output", - metavar="PATH", - help="The desired output folder (defaults to the script folder).", - default="./out", - ) - - if len(sys.argv) == 1: # Show help if no arguments - parser.print_help() - sys.exit() - - args = parser.parse_args() - - NASAL_PATH = args.fg_root - OUTPUT_PATH = args.output - if OUTPUT_PATH[-1] != '/': - OUTPUT_PATH += '/' - - get_files(nasal_dir=NASAL_PATH) diff --git a/nasal_api_docs/__init__.py b/nasal_api_docs/__init__.py new file mode 100644 index 0000000..a4646f2 --- /dev/null +++ b/nasal_api_docs/__init__.py @@ -0,0 +1,41 @@ +# Copyright (C) 2012 Adrian Musceac +# Copyright (C) 2019-2026 RenanMsV +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Nasal API Docs +============== + +A Python package for parsing and generating documentation for FlightGear Nasal scripts. + +Typical usage example: + from nasal_api_docs import NasalAPI + + nasal_api = NasalAPI(fg_root_dir="/path/to/FGRoot", output_dir="output/") + nasal_api.generate_all() + nasal_api.generate_html() +""" + +# nasal_api_docs/__init__.py +from importlib.metadata import version + +__version__ = version("nasal_api_docs") + +from .nasalapi import NasalAPI +from .logger import get_logger + +logger = get_logger() + +__all__ = ["NasalAPI", "logger"] diff --git a/nasal_api_docs/__main__.py b/nasal_api_docs/__main__.py new file mode 100644 index 0000000..523061c --- /dev/null +++ b/nasal_api_docs/__main__.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2012 Adrian Musceac +# Copyright (C) 2019-2026 RenanMsV +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Main entry point for the Nasal API documentation generator. + +Parses FlightGear Nasal scripts and generates documentation in multiple formats. +Supports command-line arguments for FlightGear data folder and output path. + +Usage: + python -m nasal_api_docs -f /path/to/fgdata/ -o ./out +""" + +import argparse +import sys +from pathlib import Path + +from nasal_api_docs import NasalAPI +from .logger import get_logger + +DEFAULT_NASAL_PATH = None +DEFAULT_OUTPUT_PATH = Path("./out") + + +def _parse_args(argv: list[str] | None = None) -> argparse.Namespace: + """Parses command-line arguments.""" + parser = argparse.ArgumentParser( + prog="nasal-api-docs", + description=( + "Auto-generate Nasal API documentation from FlightGear Nasal scripts." + ) + ) + parser.add_argument( + "-f", + metavar="PATH", + help="Path to the FlightGear Data folder.", + required=True + ) + parser.add_argument( + "-o", + metavar="PATH", + help=f"Output folder (default: {DEFAULT_OUTPUT_PATH}).", + default=str(DEFAULT_OUTPUT_PATH), + ) + + args = parser.parse_args(argv) + return args + + +def main(argv: list[str] | None = None) -> int: + """Runs the Nasal API documentation generator.""" + logger = get_logger() + + args = _parse_args(argv or sys.argv[1:]) + fg_root_dir = Path(args.f) + output_dir = Path(args.o) + + try: + nasal_api = NasalAPI(fg_root_dir, output_dir) + + fg_version = nasal_api.get_fg_version() + logger.info("Found FlightGear version %s", fg_version) + + html_file = nasal_api.generate_html() + logger.info("Generated HTML at %s", html_file) + + json_file = nasal_api.generate_json_tree() + logger.info("Generated JSON tree at %s", json_file) + + except FileNotFoundError as e: + logger.error("Missing file or directory: %s", e) + raise + except ValueError as e: + logger.error("Invalid value: %s", e) + raise + except Exception as e: # pylint: disable=broad-exception-caught + logger.error("Unexpected error: %s", e) + raise + + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/nasal_api_docs/filesystem.py b/nasal_api_docs/filesystem.py new file mode 100644 index 0000000..bd8c7af --- /dev/null +++ b/nasal_api_docs/filesystem.py @@ -0,0 +1,179 @@ +# Copyright (C) 2012 Adrian Musceac +# Copyright (C) 2019-2026 RenanMsV +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +"""Filesystem utilities for the Nasal API documentation generator. + +Provides representations for Nasal source files and functions, as well as +recursive scanning and version detection for FlightGear data trees. + +Classes: + NasalFunction: Represents a Nasal function or class. + NasalItem: Represents a file or module in the Nasal hierarchy. + NasalFileSystem: Scans the file system and builds the in-memory tree. +""" + +from __future__ import annotations +from dataclasses import dataclass, field + + +from pathlib import Path +from typing import Any, Dict, List + +from .parser import NasalParser +from .logger import get_logger +logger = get_logger() + + +@dataclass +class NasalFunction: + """Represents a Nasal function with name, args, and comments.""" + name: str + args: List[str] + comments: List[str] + type: str = "" # computed in __post_init__ + + def __post_init__(self): + self.type = "class_definition" if self.name.endswith(".") else "function" + self.name = self.name.rstrip(".") + + def to_dict(self) -> Dict[str, Any]: + """ + Converts this object to a dictionary suitable for JSON. + + Returns: + dict: The object as a dict. + """ + return { + "type": self.type, + "name": self.name, + "args": self.args, + "comments": self.comments, + } + + +@dataclass +class NasalItem: + """Represents a file or module in the Nasal hierarchy.""" + name: str + path: Path + root_path: Path + is_module: bool = False + children: list["NasalItem"] = field(default_factory=lambda: []) # submodules + functions: list["NasalFunction"] = field(default_factory=lambda: []) # files + icon: str = "" # computed in __post_init__ + rel_path: str = "" # computed in __post_init__ + id: str = "" # computed in __post_init__ + type: str = "" # computed in __post_init__ + + def __post_init__(self): + self.icon = "📁" if self.is_module else "📄" # πŸ“, πŸ“„ + self.rel_path = ( + ( + "Nasal\\" + + str((self.path / self.name).relative_to(self.root_path)) + + ("\\" if self.is_module else ".nas") + ) + .replace("\\", "/") + ) + self.id = self.rel_path[6:].lower().replace("/", "_").rstrip("_") + logger.info("Found Nasal item: %s, id: %s", self.rel_path, self.id) + + def to_dict(self) -> Dict[str, Any]: + """ + Converts this object to a dictionary suitable for JSON. + + Returns: + dict: The object as a dict. + """ + return { + "name": self.name, + "path": str(self.path), + "rel_path": self.rel_path, + "is_module": self.is_module, + "icon": self.icon, + "functions": [ + f.to_dict() + for f in self.functions + ], + "children": [child.to_dict() for child in self.children], + } + + +class NasalFileSystem: + """_summary_ + """ + _parser: NasalParser = NasalParser() + nasal_tree: List[NasalItem] + nasal_dir: Path + fg_root_dir: Path + fg_version: str + + def __init__(self, fg_root_dir: Path): + """Inits the Nasal file system.""" + self.fg_root_dir = fg_root_dir + self.nasal_dir = fg_root_dir / "Nasal" + self.fg_version = self._read_fg_version() + self.nasal_tree = self._get_nasal_tree() + + def _read_fg_version(self) -> str: + """Read FlightGear version string from the $FGROOT 'version' file.""" + version_file = self.fg_root_dir / "version" + if not version_file.exists(): + raise FileNotFoundError("Version file not found in $FGROOT") + with version_file.open("r", encoding="utf-8", errors="replace") as f: + self.fg_version = f.read(256).rstrip("\n") + return self.fg_version + + def _get_nasal_tree(self) -> List[NasalItem]: + """ + Scan the nasal_dir recursively and return a list of NasalItems (files/modules). + """ + self.nasal_dir = self.nasal_dir.resolve() + if not self.nasal_dir.exists(): + raise FileNotFoundError(f"Path does not exist: {self.nasal_dir}") + + def scan_dir(path: Path) -> List[NasalItem]: + items: List[NasalItem] = [] + for entry in sorted(path.iterdir()): + if entry.is_file() and entry.suffix == ".nas": + file_item = NasalItem( + name=entry.stem, + path=path, + root_path=self.nasal_dir + ) + # Convert tuples from parse_file() to NasalFunction objects + file_item.functions = [ + NasalFunction( + name=f[0], + args=[a.strip() for a in f[1].split(',') if a.strip()], + comments=f[2] + ) + for f in self._parser.parse_file(entry) + ] + items.append(file_item) + elif entry.is_dir(): + module_item = NasalItem( + name=entry.name, + is_module=True, + path=path, + root_path=self.nasal_dir + ) + # Recursively scan subfolder + module_item.children = scan_dir(entry) + items.append(module_item) + return items + + return scan_dir(self.nasal_dir) diff --git a/nasal_api_docs/generator.py b/nasal_api_docs/generator.py new file mode 100644 index 0000000..7fbc835 --- /dev/null +++ b/nasal_api_docs/generator.py @@ -0,0 +1,138 @@ +# Copyright (C) 2012 Adrian Musceac +# Copyright (C) 2019-2026 RenanMsV +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +"""Documentation generator for Nasal API. + +This module uses Jinja2 templates and structured data from NasalFileSystem +to produce various output formats such as HTML, JSON, Markdown, and CSV. +""" + +import json +from datetime import datetime +from pathlib import Path +from typing import List +from platform import python_version as pl_python_version + +from jinja2 import Environment, FileSystemLoader, select_autoescape +from . import __version__ # pylint: disable=cyclic-import +from .filesystem import NasalFileSystem +from .parser import NasalParser + +TEMPLATE_DIR = Path(__file__).parent / "templates" + + +class NasalDocsGenerator: + """Generate Nasal API documentation files in multiple formats. + + Attributes: + file_system (NasalFileSystem): Access to parsed Nasal tree and metadata. + output_dir (Path): Destination folder for generated documentation files. + """ + + _file_system: NasalFileSystem + output_dir: Path + + def __init__(self, file_system: NasalFileSystem, output_dir: Path): + """Initialize the documentation generator.""" + self._file_system = file_system + self.output_dir = output_dir + + def _get_timestamp_str(self) -> str: + """Return a formatted timestamp for output metadata.""" + return datetime.now().strftime("%m-%d-%Y %I-%M-%S%p") + + def generate_all(self) -> List[Path]: + """Generate all supported documentation formats. + + Returns: + list[Path]: Paths of all generated output files. + """ + files: List[Path] = [] + files.append(self.generate_html()) + files.append(self.generate_json_tree()) + return files + + def generate_html(self) -> Path: + """Generate the HTML documentation file from the Nasal tree. + + Returns: + Path: The generated HTML file path. + """ + self.output_dir.mkdir(parents=True, exist_ok=True) + out_file = ( + self.output_dir / f"nasal_api_doc-{self._file_system.fg_version}.html" + ) + timestamp = self._get_timestamp_str() + package_version = __version__ + parser_version = NasalParser.VERSION_STR + python_version = pl_python_version() + + env = Environment( + loader=FileSystemLoader(TEMPLATE_DIR / "html"), + autoescape=select_autoescape(["html"]), + trim_blocks=True, + lstrip_blocks=True, + ) + + template = env.get_template("docs_html_template.j2") + html_content = template.render( + fg_version=self._file_system.fg_version, + version=package_version, + parser_version=parser_version, + python_version=python_version, + timestamp=timestamp, + tree=self._file_system.nasal_tree, + ) + + out_file.write_text(html_content, encoding="utf-8") + return out_file + + def generate_json_tree(self): + """Generate a JSON representation of the Nasal API tree. + + Returns: + Path: Path to the generated JSON file. + """ + filename = f"json_tree-{self._file_system.fg_version}.json" + path = self.output_dir / filename + with path.open("w", encoding="utf-8") as f: + timestamp = self._get_timestamp_str() + fg_version = self._file_system.fg_version + package_version = __version__ + parser_version = NasalParser.VERSION_STR + python_version = pl_python_version() + json.dump( + { + "meta": { + "timestamp": timestamp, + "package_version": package_version, + "parser_version": parser_version, + "fg_version": fg_version, + "python_version": python_version + }, + "data": [item.to_dict() for item in self._file_system.nasal_tree], + }, + f, + indent=2, + ensure_ascii=False, + ) + return path + + def generate_markdown(self): + """Generate Markdown documentation (not yet implemented).""" + + def generate_csv(self): + """Generate CSV documentation (not yet implemented).""" diff --git a/nasal_api_docs/logger.py b/nasal_api_docs/logger.py new file mode 100644 index 0000000..2d9de48 --- /dev/null +++ b/nasal_api_docs/logger.py @@ -0,0 +1,36 @@ +# Copyright (C) 2012 Adrian Musceac +# Copyright (C) 2019-2026 RenanMsV +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +"""Package-wide logger for nasal_api_docs.""" + +import logging + + +def get_logger() -> logging.Logger: + """ + Returns a configured logger for the package. + + Returns: + logging.Logger: Configured logger instance. + """ + logger = logging.getLogger("nasal_api_docs") + if not logger.hasHandlers(): + handler = logging.StreamHandler() + formatter = logging.Formatter("%(levelname)s: %(message)s") + handler.setFormatter(formatter) + logger.addHandler(handler) + logger.setLevel(logging.INFO) + return logger diff --git a/nasal_api_docs/nasalapi.py b/nasal_api_docs/nasalapi.py new file mode 100644 index 0000000..881fa12 --- /dev/null +++ b/nasal_api_docs/nasalapi.py @@ -0,0 +1,110 @@ +# Copyright (C) 2012 Adrian Musceac +# Copyright (C) 2019-2026 RenanMsV +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +"""Nasal API main interface. + +This module provides a high-level object-oriented interface for parsing +FlightGear Nasal scripts and generating documentation in multiple formats. + +Classes: + NasalAPI: Main entry point for interacting with the Nasal parser, filesystem, + and documentation generators. +""" + +from pathlib import Path + +from .generator import NasalDocsGenerator +from .parser import NasalParser +from .filesystem import NasalFileSystem + + +class NasalAPI: + """High-level interface for the Nasal documentation generator. + + This class serves as the main entry point to interact with the package. + It encapsulates: + - File discovery and parsing via NasalFileSystem + - Documentation generation via NasalDocsGenerator + - Access to FlightGear metadata such as version and structure + + Attributes: + fg_root_dir (Path): Path to the FlightGear root data directory ($FG_ROOT). + output_dir (Path): Directory where output files will be written. + """ + + _file_system: NasalFileSystem + _generator: NasalDocsGenerator + _parser: NasalParser + + fg_root_dir: Path + output_dir: Path + + def __init__(self, fg_root_dir: Path, output_dir: Path): + """Initialize the Nasal API interface. + + Args: + fg_root_dir (Path): The FlightGear root data directory. + output_dir (Path): The directory to output generated documentation files. + """ + self.fg_root_dir = fg_root_dir + self.output_dir = output_dir + + self._file_system = NasalFileSystem(self.fg_root_dir) + self._generator = NasalDocsGenerator(self._file_system, self.output_dir) + + def get_fg_version(self) -> str: + """Return the FlightGear version detected from $FG_ROOT.""" + return self._file_system.fg_version + + def generate_html(self): + """Generate the Nasal API documentation in HTML format. + + Returns: + Path: The path of the generated HTML file. + """ + return self._generator.generate_html() + + def generate_json_tree(self): + """Generate the Nasal API tree in JSON format. + + Returns: + Path: The path of the generated JSON file. + """ + return self._generator.generate_json_tree() + + def generate_markdown(self): + """Generate the Nasal API documentation in Markdown format. + + Returns: + Path: The path of the generated Markdown file. + """ + return self._generator.generate_markdown() + + def generate_csv(self): + """Generate the Nasal API documentation in CSV format. + + Returns: + Path: The path of the generated CSV file. + """ + return self._generator.generate_csv() + + def generate_all(self): + """Generate all supported documentation formats. + + Returns: + list[Path]: List of all generated file paths. + """ + return self._generator.generate_all() diff --git a/nasal_api_docs/parser.py b/nasal_api_docs/parser.py new file mode 100644 index 0000000..77ae1c3 --- /dev/null +++ b/nasal_api_docs/parser.py @@ -0,0 +1,180 @@ +# Copyright (C) 2012 Adrian Musceac +# Copyright (C) 2019-2026 RenanMsV +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +"""Nasal parser for FlightGear scripts. + +This module uses regular expressions to extract documentation-relevant +constructs from Nasal source files. + +Extracts: + - Function definitions (top-level and member functions) + - Class declarations + - Dot-assigned functions (Class.func = func(...)) + - Comments immediately preceding definitions + +Returns: + list[tuple[str, str, list[str]]]: A structured list of definitions, + each containing the symbol name, parameter string, and preceding comments. +""" + +import re +from pathlib import Path +from typing import List, Tuple + + +# Regex patterns +_RE_VAR_CLASS = re.compile(r"^var\s*([A-Za-z0-9_-]+)\s*=\s*{\s*(\n|})") +_RE_VAR_FUNC = re.compile( + r"^var\s+([A-Za-z0-9_-]+)\s*=\s*func\s*\(?([A-Za-z0-9_\s,=.\n-]*)\)?" +) +_RE_MEMBER_FUNC = re.compile( + r"^\s*([A-Za-z0-9_-]+)\s*:\s*func\s*\(?([A-Za-z0-9_\s,=.\n-]*)\)?" +) +_RE_DOT_FUNC = re.compile( + r"^([A-Za-z0-9_-]+)\.([A-Za-z0-9_-]+)\s*=\s*func\s*\(?([A-Za-z0-9_\s,=\n.-]*)\)?" +) + + +class NasalParser: + """Parse Nasal source files into structured documentation data.""" + + VERSION = (1, 0, 0) + VERSION_STR = "1.0.0" + + _CHANGELOG = { + (1, 0, 0): "Initial release" + } + + @classmethod + def version_info(cls) -> str: + """Returns the Parser version info as a string.""" + notes = cls._CHANGELOG.get(cls.VERSION, "") + return f"Parser v{cls.VERSION_STR} β€” {notes}" + + def parse_file(self, filename: Path) -> List[Tuple[str, str, List[str]]]: + """Parse a Nasal source file. + + Args: + filename (Path): Path to the Nasal (.nas) source file. + + Returns: + list[tuple[str, str, list[str]]]: A list of tuples containing: + - The symbol name (e.g. class.func) + - The raw parameter list string + - The preceding comment lines + """ + with filename.open("r", encoding="utf-8", errors="replace") as f: + lines = f.readlines() + + result: List[Tuple[str, str, List[str]]] = [] + classname = "" + + for i, line in enumerate(lines): + # var func + match = _RE_VAR_FUNC.match(line) + if match: + func_name = match.group(1) + param = self._expand_multiline_params(lines, i, match.group(2)) + comments = self._collect_comments(lines, i) + result.append((func_name, param, comments)) + continue + + # var class + match = _RE_VAR_CLASS.match(line) + if match: + classname = match.group(1) + comments = self._collect_comments(lines, i) + result.append((classname + ".", "", comments)) + continue + + # member func inside class + match = _RE_MEMBER_FUNC.match(line) + if match and classname: + func_name = match.group(1) + param = self._expand_multiline_params(lines, i, match.group(2)) + comments = self._collect_comments(lines, i) + result.append((classname + "." + func_name, param, comments)) + continue + + # dot function: Class.func = func(...) + match = _RE_DOT_FUNC.match(line) + if match: + classname = match.group(1) + func_name = match.group(2) + param = self._expand_multiline_params(lines, i, match.group(3)) + comments = self._collect_comments(lines, i) + result.append((classname + "." + func_name, param, comments)) + continue + + return result + + def _expand_multiline_params(self, lines: list[str], index: int, param: str) -> str: + """Expand parameter lists that span multiple lines. + + Args: + lines (list[str]): The source file lines. + index (int): The current line index where parsing started. + param (str): The initial parameter string captured. + + Returns: + str: The complete parameter string. + """ + if "(" in lines[index] and ")" not in lines[index]: + k = index + 1 + while k < len(lines) and ")" not in lines[k]: + param += lines[k].rstrip("\n") + k += 1 + if k < len(lines): + param += lines[k].split(")")[0] + return param + + def _collect_comments(self, lines: list[str], index: int) -> list[str]: + """Collect contiguous preceding comments above a line. + + Scans backward from the given index and collects lines that start with `#`, + skipping up to 128 blank lines or 255 total lines. + + Args: + lines (list[str]): The source file lines. + index (int): Index of the current definition line. + + Returns: + list[str]: Cleaned comment lines in correct order. + """ + comments: list[str] = [] + empty_count = 0 + + for j in range(index - 1, max(index - 255, -1), -1): + line = lines[j] + stripped = line.strip() + + if len(stripped) < 2: + empty_count += 1 + if empty_count > 128: + break + continue + + if stripped.startswith("#"): + clean_comment = stripped.lstrip("#").strip() + if clean_comment: + comments.append(clean_comment) + else: + break + + if len(comments) > 1: + comments.reverse() + + return comments diff --git a/nasal_api_docs/templates/csv/.gitkeep b/nasal_api_docs/templates/csv/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/nasal_api_docs/templates/html/docs_html_template.css b/nasal_api_docs/templates/html/docs_html_template.css new file mode 100644 index 0000000..6d2f5e9 --- /dev/null +++ b/nasal_api_docs/templates/html/docs_html_template.css @@ -0,0 +1,129 @@ +:root { + /* light mode colors 'lt' */ + --white-color-lt: #fff; + --white-color-light-lt: #eee; + --purple-lt: #555588; + --purple-light-lt: #8888AC; + --purple-bold-lt: #383870; + --class-definition-lt: #322b2b; + --function-lt: var(--purple-bold-lt); + --args-lt: #b11515; + --comments-lt: #000; + --background-lt: var(--white-color-lt); + + /* dark mode color 'dk' */ + --white-color-dk: #e6e6e6; + --white-color-light-dk: #222239; + --purple-dk: #555588; + --purple-light-dk: #8888AC; + --purple-bold-dk: #bcbcff; + --class-definition-dk: #ddd; + --function-dk: var(--purple-bold-dk); + --args-dk: #75bbcf; + --comments-dk: var(--white-color-dk); + --background-dk: var(--white-color-light-dk); + + /* current applied colors are here */ + --white-color: var(--white-color-lt); + --white-color-light: var(--white-color-light-lt); + --purple: var(--purple-lt); + --purple-light: var(--purple-light-lt); + --purple-bold: var(--purple-bold-lt); + --class-definition: var(--class-definition-lt); + --function: var(--purple-bold-lt); + --args: var(--args-lt); + --comments: var(--comments-lt); + --background: var(--background-lt); +} + +body { + font-family: 'Fira Sans', helvetica, arial, sans-serif; + width: 1024px; + background-color: var(--background); +} +.page_title { + padding-left:20px; + display:block; + color:var(--white-color); + background-color: var(--purple); +} +.page_title span { + font-size: 14px; +} +.info_links { + background-color: var(--purple); + color: var(--white-color); + padding: 4px 4px; + border: none; + border-radius: 1px; + font-size: 16px; + cursor: pointer; + transition: background-color 0.3s, transform 0.2s; +} +.info_links:hover { + background-color: var(--purple-light); + transform: scale(1.02); +} +.info_links a { + text-decoration: none; + color: var(--white-color); +} +.right_namespace_menu { + float:right; +} +.right_namespace_menu h2 { + font-size:14px; + height:450px; + width:300px; + overflow:scroll; + display:block; + position:fixed; + top:20px; + right:20px; + background-color:var(--purple); + border:4px solid var(--purple-light); +} +.main_module_link { + margin-left:10px; + color:var(--white-color); + text-decoration: none; +} +.container { + background-color:var(--white-color-light); + clear:left; + margin-top:20px; +} +.namespace_title { + padding-left:20px; + color:var(--white-color); + background-color:var(--purple) +} +.class_function { + padding-left:20px; + background-color:var(--white-color-light); + color:var(--purple-bold) +} +.class_definition { + padding-left:20px; + background-color:var(--white-color-light); + color:var(--purple-bold) +} +.class_definition u { + color: var(--class-definition); +} +.function { + padding-left:20px; + background-color:var(--white-color-light); + color:var(--purple-bold) +} +.function span { + color: var(--args); +} +.comments { + padding-left:40px; + display:inline; + font-size:12px; + color: var(--comments); +} +.rel_path {font-size: 12px;width: 100px;} +/* hr {margin-left:30px;margin-right:30px;} */ \ No newline at end of file diff --git a/nasal_api_docs/templates/html/docs_html_template.j2 b/nasal_api_docs/templates/html/docs_html_template.j2 new file mode 100644 index 0000000..5f6a4e6 --- /dev/null +++ b/nasal_api_docs/templates/html/docs_html_template.j2 @@ -0,0 +1,102 @@ + + + + Nasal API - {{ fg_version }} + + + + + +

+ Nasal $FGROOT Library
+ + FlightGear version: {{ fg_version }} .
+ This file was generated automatically by nasal-api-docs at {{ timestamp }} .
+ nasal-api-docs v{{ version }} | Parser v{{ parser_version }} | Python v{{ python_version }} . +
+

+ + + + + + {% include "toggle_theme_button.j2" %} + +
  +

+ {% macro render_namespace_links(namespaces, level=0) %} + {% for namespace in namespaces %} + + {# Recursive call for submodules inside this namespace’s items #} + {% for child in namespace.children %} + {{ render_namespace_links([child], level + 1) }} + {% endfor %} + {% endfor %} + {% endmacro %} + + {{ render_namespace_links(tree) }} +

+
+ +{% macro render_args(args) %} +{% for arg in args %} +{{ arg.strip() }}{% if not loop.last %}, {% endif %} +{% endfor %} +{% endmacro %} + +{% macro render_comments(comments) %} +{% for comment in comments %} +
{{ comment | e }}

+{% endfor %} +{% endmacro %} + +{% macro render_namespace(namespace, level=0) %} + +
+

+ {{ namespace.icon | safe }} {{ namespace.name }} +     {{ namespace.rel_path }} +

+ + {% for function in namespace.functions %} + {% if function.type == 'class_definition' %} +
+

+ {{ namespace.name }}.{{ function.name }} +

+ {{render_comments(function.comments)}} +
+ + {% elif function.type == 'function' %} +
+

+ {{ namespace.name }}.{{ function.name }} ( {{ render_args(function.args) }} ) +

+ {{ render_comments(function.comments) }} +
+ {% endif %} + {% endfor %} + {% for child in namespace.children %} + {{ render_namespace(child, level + 1) }} + {% endfor %} +
+{% endmacro %} + + {% for namespace in tree %} + {{ render_namespace(namespace) }} + {% endfor %} + + \ No newline at end of file diff --git a/nasal_api_docs/templates/html/toggle_theme_button.j2 b/nasal_api_docs/templates/html/toggle_theme_button.j2 new file mode 100644 index 0000000..f6571ca --- /dev/null +++ b/nasal_api_docs/templates/html/toggle_theme_button.j2 @@ -0,0 +1,49 @@ + +     Theme:   + + + + + + diff --git a/nasal_api_docs/templates/markdown/.gitkeep b/nasal_api_docs/templates/markdown/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..bfec3a4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,65 @@ +[build-system] +requires = ["setuptools>=42", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "nasal-api-docs" +version = "0.2.0" +dependencies = [ + "Jinja2>=3.1.6,<4" +] +requires-python = ">=3.7" +authors = [ + { name="RenanMsV" }, + { name="Adrian Musceac" }, +] +maintainers = [ + { name = "RenanMsV" } +] +description = "Auto-generate Nasal API documentation from the FlightGear Nasal folder" +readme = "README.md" +license = "GPL-3.0-or-later" +license-files = ["LICEN[CS]E"] +keywords = ["flightgear", "nasal", "api", "documentation", "generator"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Operating System :: OS Independent", + "Intended Audience :: Developers", + "Topic :: Documentation", + "Topic :: Software Development :: Documentation", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", +] + +[project.urls] +Homepage = "https://renanmsv.github.io/nasal-api-docs/" +Documentation = "https://renanmsv.github.io/nasal-api-docs/latest/" +Repository = "https://github.com/RenanMsV/nasal-api-docs.git" +Issues = "https://github.com/RenanMsV/nasal-api-docs/issues" +Changelog = "https://github.com/RenanMsV/nasal-api-docs/CHANGELOG.md" + +[project.scripts] +nasal-api-docs = "nasal_api_docs.__main__:main" + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.package-data] +"nasal_api_docs" = ["templates/**/*"] + +[tool.setuptools.packages.find] +where = ["."] +include = ["nasal_api_docs*"] + +[tool.pytest.ini_options] +pythonpath = ["."] +testpaths = ["tests"] +addopts = "-sv" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..d3ea0f3 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,6 @@ +[flake8] +max-line-length = 88 + +[pylint] +max-line-length = 88 +disable = too-few-public-methods, too-many-instance-attributes diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..89ca8f2 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,86 @@ +# Copyright (C) 2012 Adrian Musceac +# Copyright (C) 2019-2026 RenanMsV +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +"""Shared pytest configuration and fixtures for nasal_api_docs tests.""" + +from pathlib import Path +import pytest + +from nasal_api_docs import NasalAPI + + +@pytest.fixture(scope="session") +def fg_root_dir(tmp_path_factory: pytest.TempPathFactory) -> Path: + """ + Provides a temporary fake FlightGear root directory with the minimal structure + required by tests. + + The layout will be: + tmp/ + β”œβ”€β”€ fgdata/ + β”‚ └── Nasal/ + └── output/ + + Returns: + Path: The path to the created fgdata directory (used as fg_root_dir). + """ + tmp_root = tmp_path_factory.mktemp("tmp") + + # Create folder structure + fg_dir = tmp_root / "fgdata" + nasal_dir = fg_dir / "Nasal" + + fg_dir.mkdir(parents=True, exist_ok=True) + nasal_dir.mkdir(parents=True, exist_ok=True) + + # Create a fake FlightGear version file + (fg_dir / "version").write_text("9797.1.0", encoding="utf-8") + + # Create a small fake .nas file + (nasal_dir / "aircraft.nas").write_text( + "# This is a comment first line\n" + "# \n" + "# This is a comment third line\n" + "#\n" + "var makeNode = func(n, anotherArgument) {\n" + "\tif (isa(n, props.Node))\n" + "\t\treturn n;\n" + "\telse\n" + "\t\treturn props.globals.getNode(n, 1);\n" + "}\n", + encoding="utf-8", + ) + + return fg_dir + + +@pytest.fixture(scope="session") +def output_dir(tmp_path_factory: pytest.TempPathFactory) -> Path: + """ + Provides a temporary output directory for generated documentation. + + Returns: + Path: The path to the created temporary output directory. + """ + # Let pytest handle temp directory creation and cleanup + out_dir = tmp_path_factory.mktemp("output") + return out_dir + + +@pytest.fixture(scope="session") +def nasal_api(fg_root_dir: Path, output_dir: Path) -> NasalAPI: # pylint: disable=W0621 + """Provides a ready-to-use NasalAPI instance for all tests.""" + return NasalAPI(fg_root_dir=fg_root_dir, output_dir=output_dir) diff --git a/tests/core_test.py b/tests/core_test.py new file mode 100644 index 0000000..af20740 --- /dev/null +++ b/tests/core_test.py @@ -0,0 +1,24 @@ +# Copyright (C) 2012 Adrian Musceac +# Copyright (C) 2019-2026 RenanMsV +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +"""Core integration tests for the nasal_api_docs package.""" + +from nasal_api_docs import NasalAPI + + +def test_importable(): + """Ensure the main class NasalAPI can be imported.""" + assert NasalAPI is not None diff --git a/tests/generator_test.py b/tests/generator_test.py new file mode 100644 index 0000000..dbdb21b --- /dev/null +++ b/tests/generator_test.py @@ -0,0 +1,98 @@ +# Copyright (C) 2012 Adrian Musceac +# Copyright (C) 2019-2026 RenanMsV +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +"""HTML generator tests for the nasal_api_docs package.""" + +import json +from nasal_api_docs import NasalAPI, parser + + +def test_basic_generation(nasal_api: NasalAPI): + """Test that the API can read fg_version and generate documentation.""" + version = nasal_api.get_fg_version() + assert version.startswith("9797"), "Incorrect or missing FG version" + + html_path = nasal_api.generate_html() + json_path = nasal_api.generate_json_tree() + + assert html_path.exists(), "HTML output file not created" + assert json_path.exists(), "JSON output file not created" + + +def test_html_generation(nasal_api: NasalAPI): + """Test that the API generated a reasonable enough html.""" + html_path = nasal_api.generate_html() + + assert html_path.exists(), "HTML output file not created" + + with open(html_path, "r", encoding="utf-8") as file: + data = file.read() + + assert "Nasal API - 9797.1.0" in data, "Incorrect title." + + assert "FlightGear version: 9797.1.0 .
" in data, "Incorrect FG version." + + assert ( + "Plausible.org" + ) in data, "Missing link buttons." + + assert ( + "📄 aircraft" + ) in data, "Incorrect module link in right namespace menu." + + assert ( + "📄 aircraft" + ) in data, "Incorrect namespace title." + + assert ( + "    " + "Nasal/aircraft.nas" + ) in data, "Incorrect path of Nasal file." + + assert ( + "aircraft.makeNode ( n, " + "anotherArgument )" + ) in data, "Incorrect function name and parameters." + + assert ( + "
This is a comment first line

" + ) in data, "Incorrect comment." + + assert ( + "
This is a comment third line

" + ) in data, "Incorrect comment." + + +def test_json_generation(nasal_api: NasalAPI): + """Test that the API generated a reasonable enough json.""" + json_path = nasal_api.generate_json_tree() + + assert json_path.exists(), "JSON output file not created" + + with open(json_path, "r", encoding="utf-8") as file: + data = json.load(file) + + assert data["meta"], "Missing metadata" + + assert data["meta"]["fg_version"].startswith("9797"), ( + "Incorrect or missing FG version." + ) + + assert data["meta"]["parser_version"] == parser.NasalParser.VERSION_STR, ( + "Incorrect parser version." + ) diff --git a/tests/parser_test.py b/tests/parser_test.py new file mode 100644 index 0000000..f5ffa2e --- /dev/null +++ b/tests/parser_test.py @@ -0,0 +1,177 @@ +# Copyright (C) 2012 Adrian Musceac +# Copyright (C) 2019-2026 RenanMsV +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +"""Unit tests for the NasalParser.""" + +from pathlib import Path +from typing import List, Tuple + +from nasal_api_docs.parser import NasalParser + + +def test_parse_basic_var_function(tmp_path: Path) -> None: + """ + Verify that the parser can detect a simple Nasal function definition. + + Example: var foo = func(...) + + Ensures: + - One function definition is detected. + - Function name and parameters are parsed correctly. + - Correct comments are attached to the parsed result. + """ + file: Path = tmp_path / "simple_var_function.nas" + file.write_text( + "# hello this is a comment\n" + "#\n" + "var foo = func(a, b) {\n \n\treturn a + b; \n}\n", + encoding="utf-8" + ) + + parser: NasalParser = NasalParser() + result: List[Tuple[str, str, List[str]]] = parser.parse_file(file) + + assert len(result) == 1, "Expected one function definition." + + name: str + params: str + comments: List[str] + name, params, comments = result[0] + + assert name == "foo", "Expected name to be 'foo'." + assert params == "a, b", "Missing or invalid params." + assert comments == ["hello this is a comment"], ( + "Expected comments to be a single line. " + "The empty comment line should have been ignored." + ) + + +def test_parse_basic_dot_function(tmp_path: Path) -> None: + """ + Verify that the parser can detect a simple Nasal dot function definition. + + Example: Class.func = func(...) + + Ensures: + - One function definition is detected. + - Function name and parameters are parsed correctly. + - Correct comments are attached to the parsed result. + """ + file: Path = tmp_path / "simple_dot_function.nas" + file.write_text( + "# hello this is a comment\n" + "#\n" + "Class.new = func(a, b) {\n" + " return a + b;\n" + "}\n", + encoding="utf-8" + ) + + parser: NasalParser = NasalParser() + result: List[Tuple[str, str, List[str]]] = parser.parse_file(file) + + assert len(result) == 1, "Expected one function definition." + + name: str + params: str + comments: List[str] + name, params, comments = result[0] + + assert name == "Class.new", "Expected name to be 'Class.new'." + assert params == "a, b", "Missing or invalid params." + assert comments == ["hello this is a comment"], ( + "Expected comments to be a single line. " + "The empty comment line should have been ignored." + ) + + +def test_parse_basic_var_class(tmp_path: Path) -> None: + """ + Verify that the parser can detect a simple Nasal var class definition. + + Example: var Class = {...} + + Ensures: + - One class definition is detected. + - Class name is parsed correctly. + - Correct comments are attached to the parsed result. + """ + file: Path = tmp_path / "simple_var_class.nas" + file.write_text( + "# hello this is a comment\n" + "#\n" + "var Class = {\n" + "}\n", + encoding="utf-8" + ) + + parser: NasalParser = NasalParser() + result: List[Tuple[str, str, List[str]]] = parser.parse_file(file) + + assert len(result) == 1, "Expected one function definition." + + name: str + params: str + comments: List[str] + name, params, comments = result[0] + + assert name == "Class.", "Expected name to be 'Class.'." + assert params == "", "Expected no parameters." + assert comments == ["hello this is a comment"], ( + "Expected comments to be a single line. " + "The empty comment line should have been ignored." + ) + + +def test_parse_basic_member_function(tmp_path: Path) -> None: + """ + Verify that the parser can detect a simple Nasal member function definition. + + Example: var Class = { init: func {...}} + + Ensures: + - One class and one member function definition are detected. + - Class and member function name is parsed correctly. + - Correct comments are attached to the parsed result. + """ + file: Path = tmp_path / "simple_member_function.nas" + file.write_text( + "# hello this is a comment\n" + "#\n" + "var Class = {\n" + "# hello this is a comment\n" + "#\n" + "\tinit: func (a, b) {}\n" + "}\n", + encoding="utf-8" + ) + + parser: NasalParser = NasalParser() + result: List[Tuple[str, str, List[str]]] = parser.parse_file(file) + + assert len(result) == 2, "Expected two definitions." + + member_name: str + member_params: str + member_comments: List[str] + member_name, member_params, member_comments = result[1] + + assert member_name == "Class.init", "Expected name to be 'Class.init'." + assert member_params == "a, b", "Missing or invalid params." + assert member_comments == ["hello this is a comment"], ( + "Expected comments to be a single line. " + "The empty comment line should have been ignored." + )