Question about MP Plugin Lifecycle / Return Value

Hello,

In the Mission Planner plugin class, there are main abstract or virtual functions that need to be implemented for the plugin to work properly. :
Init();
Loaded();
Loop();
Exit();

My Question : What is appropriate return value for Loop() and Exit()?

Detailed Question :
I understand the roles of Init() and Loaded()'s return value. If either of them returns false, the plugin will not proceed to the next stage of the lifecycle.

In PluginLoader.cs, I found that LoadAll() calls InitPlugin() and then PluginInit(). If Init() returns false, the plugin is not added to the loading list, and consequently, Loaded() will not be called. That part is clear.

However, regarding the Loop() function:

I see that it’s called in MainV2, but its return value isn’t used anywhere.

                          plugin.NextRun = DateTime.Now.AddMilliseconds(msnext);

                          if (plugin.NextRun < minnextrun)
                              minnextrun = plugin.NextRun;

                          try
                          {
                              bool ans = plugin.Loop();
                          }
                          catch (Exception ex)
                          {
                              log.Error(ex);
                          }

I’m wondering if this return value is reserved for future use, or if there’s any specific purpose it serves.

Similarly, the Exit() function also has a return value. I’m curious what the return value of Exit() is intended for. From my testing, it seems that returning either true or false does not result in any noticeable difference.

Thank you.

They are not used and there is no plan to use them in the future.

1 Like