If yes, how?
In concrete: In the plugin Preview there is a function that is needed in the plugin Lua Script.
Thank you for an answer in advance.
Short answer, no, there is no way of guaranteeing that another plugin is loaded and remains loaded. The user can unload at any time.
Long answer, if by agreement with the relevant plugin maintainer the function is moved to a common library that can be shared by both plugins it can happen since whichever is loaded first will load the library and it will stay loaded until nobody uses it. There is the utils library that works like this and maybe the function might be added to, but who maintains it should be agreed (and written down :-)
Of course that won't work if the function is not standalone but uses lots more of the plugin's functions.
PS this should be a discussion on G-P but discussions are not enabled on that repo, any reason @frlan ?
Short answer, no, there is no way of guaranteeing that another plugin is loaded and remains loaded. The user can unload at any time.
OK, so does that mean that if both plugins are activated in the `Plugin Manager` and stay activated in the `Plugin Manager`, that a plugin can have access to the functions of the other plugin?
OK, so does that mean that if both plugins are activated in the Plugin Manager and stay activated in the Plugin Manager, that a plugin can have access to the functions of the other plugin?
I don't think so, plugins are shared objects, but are loaded `G_MODULE_BIND_LOCAL` which means their symbols are not available to other shared objects, ie other plugins, so the name of the function won't be found.
BTW which plugin did you mean "Preview"? I can't see any such in Geany or Geany-Plugins?
https://github.com/xiota/geany-preview
Well, Geanylua would not be allowed to depend on an external plugin, although of course you can do whatever you want for yourself.
Closed #3431 as resolved.
github-comments@lists.geany.org