cock.convertJoystickHat

Converts literal to numerical joystick hat names and vice versa.

Function

Synopsis

converted = cock.convertJoystickHat ( input, forceliteral )

Arguments

number input
Joystick hat name, numerical or literal.
boolean forceliteral
Optional. Forces literal ("true") or numerical ("false") output. Will perform conversion regardless if not provided.

Returns

string converted
Converted joystick hat.

Remarks

Function will make no change if it was supplied with literal input and forced to output literal value. Same for numerical values.

Unlike cock.convertDevice, this function aims specifically at joystick hats. It converts hat name to hat number rather than device number. E.g. "joystick hat 3" converted to "3" and vice versa, and not to "8" as with convertDevice function.

See also