I'm going to help you cheat a bit here - but only because the original code that this was based off of was given to me by Pengoros
put this in your Main.lua script:
Code:
pluginName="myPluginsName";
window = Turbine.UI.Window();
window:SetWantsUpdates(true);
window.Update = function(sender,args)
if (Plugins[pluginName] ~= nil) then
Plugins[pluginName].Unload = function(self,sender,args)
UnloadPlugin();
end
window:SetWantsUpdates(false);
end
end
This will call a function called "UnloadPlugin()" when the plugin is being unloaded. This function would be a great place to put that PluginData.Save() line.