> On my machine I observe that the various scripts in
> the Nasal/ directory get loaded in some hard-to-predict
> order.
The scripts get loaded in the order of appearence in the directory. There is 
no specific order specified and the order might depend on the operating 
system. On *nixes opendir() and readdir() are used to enumerate the file while 
on Windows FindFirstFile/FindNextFile do the job.
> 
> That means that if you write a script called foo.nas,
> it's hard to know whether it will get processed before
> or after math.nas and/or props.nas.
> 
> So the question is, what to do if foo.nas wants to make
> use of the features provided by the other scripts?
> 
> I know about the trick of using settimer(stuff, 0).
That trick is not recommended. The recommended way of making sure all scripts 
in the nasal-dir are fully loaded is to use a listener on nasal-dir-
initialized. You should find many examples in the nasal directory.
> 
> But what if we wanted to use math functions in the
> code that actually runs at the time the scripts are
> loaded?
Use the listener.
> 
> In particular, does nasal have any sort of "#include"
> directive (as in c++) or "require" or "use" directive
> (as in perl)?  If so, is it documented somewhere?  If
> not, has anybody thought about how to implement it?
Our nasal version does not. If some day we adopt a newer nasal library, it has 
support for import("foo"); to import foo.nas.

Greetings, Torsten

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to