Forums » Suggestions

Lua - Make the plugin relative path consisent

Dec 08, 2022 draugath link
Could you make the plugin relative path consistent between the times when the plugin is being loaded and after it has been loaded.

At the moment, when plugins are being loaded the relative path is the plugin's own directory. However, once plugins are loaded, the relative path changes to the vendetta directory. This can make loading files or images after load time a little troublesome, since you have to account for the different states of the game.

Technically it's not that difficult to just change a local variable holding the relative path during the PLUGINS_LOADED event. But this also has the added issue of not being flexible in the case of a directory name change by the end-user.

To further extend this, it would be helpful if the plugin directory could be queried with a function, rather than having to hard code it into the files.
Dec 08, 2022 draugath link
It just dawned on me that this would break almost every plugin if it were implemented one way or another.
Dec 08, 2022 Luxen link
How about, *IF* a plugin needs its path, it can query the path variable using a function. plugins should expect to get their path when they are run, or they could retrieve someone else's path by mistake. This would allow new plugins to utilize the feature, without breaking every single older one.