I’m not used to ask questions, but when I need to I do.

I’m not used to ask questions, but when I need to I do.

How can I delete a variable so it doesn’t show in the lightning variables list?

(And I’m asking for a ‘normal’ way from a lightning menu and/or script. I know I can edit the variables file and force kill the launcher Lukas Morawietz​ 😉

]]>
« (Previous Post)
(Next Post) »

7 Commentsto I’m not used to ask questions, but when I need to I do.

  1. Anonymous says:

    < ![CDATA[

    I answered a part of the question


    LL.getVariables().edit().setX(thename,null).commit();



    Is it possible to delete a variable without using scripts?

    ]]>

  2. Anonymous says:

    < ![CDATA[

    set to null doesn’t work for all types, because Integers can’t be null.

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Hmm, that’s true.


    But if you use setString whichever type the variable is, it is deleted correctly.

    ]]>

  4. Anonymous says:

    < ![CDATA[

    Didn’t test, but maybe undefined will better work?

    ]]>

  5. Anonymous says:

    < ![CDATA[

    Benoît de Chezelles it makes an error too.

    ]]>

  6. Anonymous says:

    < ![CDATA[

    Okay..

    ]]>

  7. Anonymous says:

    < ![CDATA[

    Internally a variable is a pair String/Object, and as a consequence all variables can be “nullified”. The value itself is interpreted according to the context and the script API provides variants to help in setting the type of the data. There could be a setVariableObject(String, Object) method but probably it would only be useful with null and a clearVariable(String) may be more appropriate.


    The reason why setString works as expected is because it directly uses the single internal setVariable call, since a String is… an Object.



    Variables are created:


    – when referenced from a binding or script, with a null value, which is an acceptable value (translated to false, 0, 0.0, or “” according to the use)


    – when set


    – when starting the app if saved previously



    Variables are never deleted until the app is stopped and their value is null. If something has a reference on the variable it would be recreated anyway.

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *