Nasal library/io: Difference between revisions

Jump to navigation Jump to search
→‎Functions: Doc dirname()
(→‎close(): Add example)
(→‎Functions: Doc dirname())
Line 31: Line 31:


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


=== flush() ===
=== flush() ===

Navigation menu