There is almost never any reason to expressly register and use PLAYER_LOGOUT to write your saved variables, as the game automatically writes SVs to disc during that event, meaning you don't have to do it.
The only reason I can think where someone might do it is if they use local references to longer SV tables and want to re-map the SVs to the local references. Usually nobody does this as it makes debugging a lot more difficult.
You can also use PLAYER_LOGIN to create or verify your SV table instead of ADDON_LOADED, mostly because PL only ever fires once and you don't have to parse the results until your addon is found.
|