Nasal library: Difference between revisions

Add Extension functions new in FG 2020.1
(Add Extension functions new in FG 2020.1)
Line 2,344: Line 2,344:
}}
}}


== Extension functions new in FG 2020.1 ==
The following functions have been added to the nasal core library and will be released with FlightGear version 2020.1.
Befor the release they are available in the development branch "next".
=== isint() ===
Returns 1 if argument has a numeric value and x == floor(x), e.g. integer
=== isnum() ===
{{Nasal doc
|syntax = isnum(x);
|source = {{simgear file|simgear/nasal/lib.c|t=Source}}
|text = Returns 1 if x has a numeric value otherwise 0.
}}
=== isghost() ===
Returns 1 if type or argument is a ghost, otherwise 0.
=== isstr() ===
Returns 1 if type or argument is a string, otherwise 0.
=== isvec() ===
Returns 1 if type or argument is a vector, otherwise 0.
=== ishash() ===
Returns 1 if type or argument is a hash, otherwise 0.
=== isfunc() ===
Returns 1 if type or argument is a function, otherwise 0.
=== vecindex() ===
{{Nasal doc
|syntax = vecindex(vector, value);
|source = {{simgear file|simgear/nasal/lib.c|t=Source}}
|text = Returns the index of value or nil, if value is not found in vector.
}}
== Variables ==
== Variables ==
Various global constants (technically variables) are provided for use in converting between different units. They are all found in {{fgdata file|Nasal/globals.nas|text=$FG_ROOT/Nasal/globals.nas}}.
Various global constants (technically variables) are provided for use in converting between different units. They are all found in {{fgdata file|Nasal/globals.nas|text=$FG_ROOT/Nasal/globals.nas}}.
252

edits