Library globals

Namespace globals . globals

View source

Constants.

Functions

abs

Utility. Does what you think it does.

assert

Aborts execution if <condition> evaluates to false. Prints an optional message if present, or just "assertion failed!"

cmdarg

Returns the SGPropertyNode argument to the currently executing function. Wrapper for the internal _cmdarg function that retrieves the ghost handle to the argument and wraps it in a props.Node object.

defined

Returns true if the symbol name is defined in the caller, or the caller's lexical namespace. (i.e. defined("varname") tells you if you can use varname in an expression without a undefined symbol error.

fgcommand

Invokes a FlightGear command specified by the first argument. The second argument specifies the property tree to be passed to the command as its argument. It may be either a props.Node object or a string, in which case it specifies a path in the global property tree.

interpolate

Convenience wrapper for the _interpolate function. Takes a single string or props.Node object in arg[0] indicating a target property, and a variable-length list of time/value pairs. Example: interpolate("/animations/radar/angle", 180, 1, 360, 1, 0, 0, 180, 1, 360, 1, 0, 0, 180, 1, 360, 1, 0, 0, 180, 1, 360, 1, 0, 0, 180, 1, 360, 1, 0, 0, 180, 1, 360, 1, 0, 0, 180, 1, 360, 1, 0, 0, 180, 1, 360, 1, 0, 0); This will swing the "radar dish" smoothly through 8 revolutions over 16 seconds. Note the use of zero-time interpolation between 360 and 0 to wrap the interpolated value properly.

isa

Returns true if the first object is an instance of the second (class) object. Example: isa(someObject, props.Node)

printf

Just what it says it is.

printlog

setlistener

Wrapper for the _setlistener function. Takes a property path string or props.Node object in arg[0] indicating the listened to property, a function in arg[1], an optional bool in arg[2], which triggers the function initially if true, and an optional integer in arg[3], which sets the listener's runtime behavior to "only trigger on change" (0), "always trigger on write" (1), and "trigger even when children are written to" (2).

thisfunc

Returns reference to calling function. This allows a function to reliably call itself from a closure, rather than the global function with the same name.

values

Returns vector of hash values.

Variables

D2R

Constants.

FPS2KT

FT2M

GAL2L

IN2M

KG2LB

KT2FPS

KT2MPS

L2GAL

LB2KG

M2FT

M2IN

M2NM

MPS2KT

NM2M

R2D