Nasal library/io: Difference between revisions

Jump to navigation Jump to search
→‎include(): Add example
(→‎flush(): Change file mode)
(→‎include(): Add example)
Line 73: Line 73:
|param1 = file
|param1 = file
|param1text = Path to file as a string. If it is just a filename, it will be assumed that the file is in the same folder as calling script. Otherwise, it will be searched for in the standard FlightGear directories (see [[Resolving Paths]]).
|param1text = Path to file as a string. If it is just a filename, it will be assumed that the file is in the same folder as calling script. Otherwise, it will be searched for in the standard FlightGear directories (see [[Resolving Paths]]).
|example1 =  
|example1 = io.include("Nasal/geo.nas"); # include the geo namespace
var coord = Coord.new(); # create a new Coord object
coord.set_latlon(0, 0, 2000); # set coordinates
print(coord.alt()); # prints "2000"
}}
}}


Navigation menu