ReloadUI kills the entire current Lua state and loads a new one. The current stack is never processed.
You'd have to set a SavedVariable before reload, then look for your addon's ADDON_LOADED and see if the var is set - if it is, you show the second dialog box and unset the var.
---------- Post added 2012-08-17 at 08:17 PM ----------
Originally Posted by
SpaceDuck
when linking frames to each other you need to work backwards, so the last frame that appears (in your case StaticPopupDialogs["ChatBox2"]) needs to be the first to be coded
also im not sure if you can get the 2nd static popup to appear directly after a reload, but i could be wrong
Not really, in this case. Table lookups work by reference + indexing (as opposed to locals, where the name is merely an alias for an index on the stack and doesn't even show in the precompiled code).
For example, this will work:
Code:
local a = {}
local function b() print(a["c"]) end
a["c"] = 42
print(a) -- 42
This is because the preprocessor knows that "a" refers to a local (identified by stack index) when it processes the function body. The table lookup 'a["c"]' is done at runtime (a GETTABLE in the processed file) - only the table itself is fixed by the "a" local that is embedded in the function body.
As opposed to this, which will not work:
Code:
local function b() print(a) end
local a = 42
print(a) -- nil
This is because the preprocessor does not know what "a" refers to when it builds the "b" function body. It thus assumes that "a" is a global (which it isn't).