1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

FSXA Multiple units question

Discussion in 'Gauges' started by delivery guy, 21 Apr 2017.

  1. delivery guy

    delivery guy

    Joined:
    31 Jan 2010
    Messages:
    1,498
    Country:
    unitedstates
    The question is why do different types of xml coding still work with any three of these units.
    It seems that these units all work with 2 digits or 100 digits.
    Bool
    Enum
    Number

    I am opening a thread in this topic to answer this question for everyone.
     
  2. taguilo

    taguilo Resource contributor

    Joined:
    20 Oct 2006
    Messages:
    1,462
    Country:
    argentina
    Answer is simple: because LVars have a single data type, double, which only accepts floating point values.

    Bool and enum are of integer type in common programming languages; I guess they are maintained as units in LVars just for logical compatibility.

    Tom
     
  3. tgibson

    tgibson

    Joined:
    22 Sep 2006
    Messages:
    6,706
    Country:
    us-california
    As Tom says, people use Enum and Bool in their L: variables so they know what kind of logic is being used for this particular code. You could use Number for all of them if you wanted to.
     
  4. delivery guy

    delivery guy

    Joined:
    31 Jan 2010
    Messages:
    1,498
    Country:
    unitedstates
    So from what I have learned over the years you can use any of these units for common values. Listed below is the meanings to best convey the intent of the coder.

    1. Bool is best used for off and on modes. 2 values.
    2. Enum is best used for when you have a meaning for each value. Enum can have any amount of values.
    3. Number is best used when you have numbers as the value. There is no meaning it's just raw data.
     
    Last edited: 27 Apr 2017
  5. tgibson

    tgibson

    Joined:
    22 Sep 2006
    Messages:
    6,706
    Country:
    us-california
    Correct, and Enum therefore normally uses integers.
     

Share This Page