openplanet-nl / issues

Issue tracker for Openplanet.
10 stars 0 forks source link

Possibility to add `Meta::Plugin::Reload()` method to reload our or any other plugin programmatically #154

Closed GreepTheSheep closed 2 years ago

GreepTheSheep commented 2 years ago

I have a setting that requires plugin reloading after updating. But I'm looking for a way to make my plugin reloading itself after changing its settings.

codecat commented 2 years ago

Do you really need this to be done through the Meta API? Why can't you just re-initialize everything yourself?

GreepTheSheep commented 2 years ago

Yeah that could be possible.

codecat commented 2 years ago

How much more work would it be to do that for you? Just so I can judge the need for a feature like this. What kind of a setting is it?

GreepTheSheep commented 2 years ago

Selecting between tm.mania.exchange and sm.mania.exchange on ManiaExchange plugin on MP4. But I managed to reload when its settings changes, so that's good now

codecat commented 2 years ago

Unloading a plugin via scripts is already pretty unsafe, because the resulting Plugin@ can no longer be used. Having a Reload() function works similarly, and thus would be kind of confusing if implemented:

plugin.Reload();
print("Reloaded " + plugin.Name); // Crash, because plugin is no longer valid!

I'll close this for now.