Nasal library/geo: Difference between revisions

Jump to navigation Jump to search
Add getter methods
(Save)
(Add getter methods)
Line 138: Line 138:
coord.set_xyz(10, 10, 10);
coord.set_xyz(10, 10, 10);
coord.dump();
coord.dump();
}}
==== lat() ====
{{Nasal doc
|syntax = geo.Coord.lat();
|source = {{fgdata file|Nasal/geo.nas|t=Source}}
|text = Returns the latitude coordinate.
|example1 = var coord = geo.Coord.new();
coord.set_latlon(98, 173);
print(coord.lat()); # prints "98"
}}
==== lon() ====
{{Nasal doc
|syntax = geo.Coord.lon();
|source = {{fgdata file|Nasal/geo.nas|t=Source}}
|text = Returns the longitude coordinate.
|example1 = var coord = geo.Coord.new();
coord.set_latlon(98, 173);
print(coord.lon()); # prints "173"
}}
==== alt() ====
{{Nasal doc
|syntax = geo.Coord.alt();
|source = {{fgdata file|Nasal/geo.nas|t=Source}}
|text = Returns the altitude coordinate.
|example1 = var coord = geo.Coord.new();
coord.set_latlon(98, 173, 10);
print(coord.alt()); # prints "10"
}}
==== latlon() ====
{{Nasal doc
|syntax = geo.Coord.latlon();
|source = {{fgdata file|Nasal/geo.nas|t=Source}}
|text = Returns a vector containing the latitude, longitude, and altitude, in that order.
|example1 = var coord = geo.Coord.new();
coord.set_latlon(98, 173, 10);
debug.dump(coord.latlon()); # prints "[98, 173, 10]"
}}
==== x() ====
{{Nasal doc
|syntax = geo.Coord.x();
|source = {{fgdata file|Nasal/geo.nas|t=Source}}
|text = Returns the x-axis coordinate.
|example1 = var coord = geo.Coord.new();
coord.set_xyz(10, 10, 10);
print(coord.x()); # prints "10"
}}
==== y() ====
{{Nasal doc
|syntax = geo.Coord.y();
|source = {{fgdata file|Nasal/geo.nas|t=Source}}
|text = Returns the y-axis coordinate.
|example1 = var coord = geo.Coord.new();
coord.set_xyz(10, 10, 10);
print(coord.y()); # prints "10"
}}
==== z() ====
{{Nasal doc
|syntax = geo.Coord.z();
|source = {{fgdata file|Nasal/geo.nas|t=Source}}
|text = Returns the z-axis coordinate.
|example1 = var coord = geo.Coord.new();
coord.set_xyz(10, 10, 10);
print(coord.z()); # prints "10"
}}
==== xyz() ====
{{Nasal doc
|syntax = geo.Coord.xyz();
|source = {{fgdata file|Nasal/geo.nas|t=Source}}
|text = Returns a vector containing the x, y, and z coordinates, in that order.
|example1 = var coord = geo.Coord.new();
coord.set_xyz(20, 10, 30);
debug.dump(coord.xyz()); # prints "[20, 10, 30]"
}}
}}


Navigation menu