I had a thought I could achieve this with a single variable that makes the plugin do everything as though it was a first time install. That would remove all old info. I would need a little note to the user on re-installing the plugin from the plugins dialog but it would only be when the plugin had a repeating error because it was saving and loading bad info this happens when I change the plugin a lot then load it into a world with an old state file. But it makes me want an easy way to fix up with out needing to open a file manager.
Ah, yes, the DoAfterSpecial just defers for one second something it can't do now, to something it can't do a second later. :)
I note the help says "use something like DoAfterSpecial". Maybe some different approach? You need to somehow reload the plugin in global script space, not plugin script space. A running plugin can hardly reload itself.
However I would suggest fixing your problem a different way. For example, since Lua keeps everything in tables, just re-initialize the tables, rather than reloading the plugin.
local action = "DoAfterSpecial(1, ReloadPlugin('" .. GetPluginID() .. "'), 12)"
local prefix = GetAlphaOption("script_prefix")
if prefix == "" then
SetAlphaOption("script_prefix", "/")
Execute("/" .. action)
SetAlphaOption("script_prefix", "")
else
Execute(prefix .. action)
end
I think that would work.
Note of warning: This crashes MUSHclient for me initiating it from the input bar with CallPlugin even if I put the Executes in their own DoAfterSpecials. I don't understand why.