You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am a Lua newbie, so just wanted to drop a heads-up to anyone who wanted to use this plugin as a base for their own plugin (http calls, sql, settings are present).
Lua's require statement works using a map/table for files that are loaded. So, if you also name a file settings.lua in your plugin, and try to import it using require("settings"), that will actually see if somewhere else someone has imported require("settings") and resolve it using that.
Lost an hour because I was trying to import my own plugin's settings, but it kept resolving to koinsight's settings file.
To get around this, you can use a unique-ish name for your file, I guess?? I tried to see if an absolute path like `plugins/myplugin/settings" would work, but nada.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hey,
I am a Lua newbie, so just wanted to drop a heads-up to anyone who wanted to use this plugin as a base for their own plugin (http calls, sql, settings are present).
Lua's require statement works using a map/table for files that are loaded. So, if you also name a file settings.lua in your plugin, and try to import it using
require("settings")
, that will actually see if somewhere else someone has importedrequire("settings")
and resolve it using that.Lost an hour because I was trying to import my own plugin's settings, but it kept resolving to koinsight's settings file.
To get around this, you can use a unique-ish name for your file, I guess?? I tried to see if an absolute path like `plugins/myplugin/settings" would work, but nada.
Beta Was this translation helpful? Give feedback.
All reactions