Local global & garbage in visionaire lua

  • #1, by pietro-eccherFriday, 08. November 2019, 12:41 5 years ago
    Hi, I used lua extensively in the past and I learned that local and garbage collection should always be the way to go. Is there a way to localize conditions, values and functions or are they always saved in the respective global tables? 
    Can I nil those values after I used them if I no longer need them?
    What about NPCs? It doesn't make much sense to "keep alive" a tutorial guy after his purpose has been fulfilled.. smile

    Thank you!


    Newbie

    29 Posts


  • #2, by SimonSFriday, 08. November 2019, 13:25 5 years ago
    Hi, Visionaire uses the lua_ref functions to keep all visionaire objects (conditions, values, scenes, objects,...) alive. So all visionaire objects are singletons and you don't need to worry about them. Even if you nil them. Except game propably.

    Considering everything else, that all is handled by lua. So if you have local tables, they are collected when they go out of scope. 

    Thread Captain

    1582 Posts