Nasal library/io: Difference between revisions

(Put in alphabetical order)
Line 5: Line 5:
== Functions ==
== Functions ==
=== basename() ===
=== basename() ===
Works like standard Unix command basename. Returns the file name from a given path.
{{Nasal doc
<syntaxhighlight lang="nasal">
|syntax = io.basename(path);
io.basename(<path>);
|version = 3.0
</syntaxhighlight>
|commit = {{fgdata commit|6ae3fa|t=commit}}
|text = Returns last element of a path as a string.
|param1 = path
|param1text = Path as a string.
|example1 = var path = '/demo/demo.xml';
print(io.basename(path)); # prints "demo.xml"
|example2 = var path = 'C:\FlightGear\FlightGear 3.2.0\data';
print(io.basename(path)); # prints "data"
}}


=== close(filehandle) ===
=== close(filehandle) ===