so more rooting and digging about and i notice in the property tree that a lot of nasal is loaded in nasal files named in the property tree instead of actual script in the property tree... hummm... ok, so we use io.load_nasal() to do that... a quick edit to put all the nasal into view_handler.nas like it was in the original file, including the view.manager.register call... then change main() to be
- Code: Select all
var main = func( root ) {
io.load_nasal("view_handler.nas");
} # func main()
so now i get, half expectedly, the following error...
- Code: Select all
Initializing addon from /home/myuser/myflightgear/Addons/cockpit-view/main.nas in __addon[0]__
Cannot stat file: view_handler.nas:
at /home/myuser/flightgear-dev/fgdata-ng/Nasal/io.nas, line 4
called from: /home/myuser/flightgear-dev/fgdata-ng/Nasal/io.nas, line 84
called from: /home/myuser/myflightgear/Addons/cockpit-view/main.nas, line 84
so the question now is how do i tell main() what the path is to the file when it could be located anywhere on the file system?
i half expected this error because i couldn't be so lucky as to have the system load it from the current directory where the script is loaded from... granted, the path is in "/addons/addon/path" but that could be "/addons/addon[27]/path" the next time it is loaded...
is there something like self.location where i could do something like this?
- Code: Select all
var main = func( root ) {
io.load_nasal(self.location("view_handler.nas"));
} # func main()
/me goes off back into the deep deep woods digging and rooting around some more...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."