Nasal library: Difference between revisions

Jump to navigation Jump to search
1,212 bytes removed ,  25 April 2016
Remove commented-out stuff
(Update first paragraph)
(Remove commented-out stuff)
Line 2,267: Line 2,267:
|syntax = var degrees = radians * R2D;
|syntax = var degrees = radians * R2D;
|text = Converts an angle from radians to degrees when multiplied by the angle in radians. Equal to <code>180 / π</code>.
|text = Converts an angle from radians to degrees when multiplied by the angle in radians. Equal to <code>180 / π</code>.
}}<!--
}}


=== history() (3.1+) ===
Function to expose flight history as aircraft.history()
<syntaxhighlight lang="nasal">
var hist = aircraft.history();
# get history of aircraft position/orientation collapsing
# nodes with a distance smaller than the given minimum
# edge length
debug.dump( hist.pathForHistory(<minimum-edge-length-meter>) );
</syntaxhighlight>
=== HTTP module (2.99+) ===
Get remote data using the HTTP.
==== http.load() ====
Load resource identified by its URL into memory.
<syntaxhighlight lang="nasal">
var request = http.load(<url>);
</syntaxhighlight>
<syntaxhighlight lang="nasal">
http.load("http://example.com/test.txt")
    .done(func(r) print("Got response: " ~ r.response));
</syntaxhighlight>
==== http.save() ====
Save resource to a local file.
<syntaxhighlight lang="nasal">
var request = http.save(<url>, <file_path>);
</syntaxhighlight>
<syntaxhighlight lang="nasal">
http.save("http://example.com/test.png", getprop('/sim/fg-home') ~ '/cache/test.png')
    .fail(func print("Download failed!"))
    .done(func(r) print("Finished request with status: " ~ r.status ~ " " ~ r.reason))
    .always(func print("Request complete (fail or success)"));
</syntaxhighlight>
-->
{{Appendix}}
{{Appendix}}

Navigation menu