Nasal library functions: Difference between revisions

Jump to navigation Jump to search
Line 147: Line 147:
Example :  
Example :  
<syntaxhighlight lang="nasal" enclose="div">
<syntaxhighlight lang="nasal" enclose="div">
var currentPath = "/home/xxx/yyy/";
var FGRoot = getprop("/sim/fg-root");
print (directory(currentPath));
var filename = "/Aircraft";
var path = FGRoot ~ filename;
var path_files = directory(FGRoot ~ filename);
 
foreach(var key; path_files) {
print(key);
}
</syntaxhighlight>
</syntaxhighlight>
 
returns :  
returns :
'''"." , ".." , "Generic", "Instruments", "Instruments-3d", "c172p", "ufo"'''
:"."
:".."
:"file1"
:"file2"
:"file3"


To delete the "." and ".." see the subvec() function.
To delete the "." and ".." see the subvec() function.
29

edits

Navigation menu