Forums » Suggestions
Lua - Make the plugin relative path consisent
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.
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.
It just dawned on me that this would break almost every plugin if it were implemented one way or another.
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.