is comparing variables bug?

  • Hello, everyone!

    I need your help to resolve my issue! I'm writing code which should invoke showtext. My variable get the value of any character string, empty string and value 0. Depending on the case i need to check if variable is 0 or empty string like this. Additional information may be that the variable is taken from the krpanoteamplate. Pice of code from template.xml:


    <hotspot name="{{Id}}" type="image" style="style" ath="{{Longitude}}" atv="{{invertLatitude}}"
    name="{{name}}" />

    and also i have action which invoke external plugin "showtext" depending on variable if doesn't empty, like this:

    if(name !== ' ', showtext(get(name), warpNameStyle, screenX, screenY););



    it works partly! but if variable 'name' has 0, it's also will ommited!!



    I came to conclusion that 0 and ' ' is the same type??


    I made quick test:

    set(a, "");
    set(b, 0);

    if(a == b, trace('TRUE'));
    if(a === b, trace('TRUE'));

    and i got TRUE for two cases!!!!!

    My question is. How can i invoke showtext while variable has 0? And how compares these variables a,b?

    Greetings!!

    Einmal editiert, zuletzt von rejentt (11. Dezember 2017 um 15:01)

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!