pkulchenko / ZeroBraneStudio

Lightweight Lua-based IDE for Lua with code completion, syntax highlighting, live coding, remote debugger, and code analyzer; supports Lua 5.1, 5.2, 5.3, 5.4, LuaJIT and other Lua interpreters on Windows, macOS, and Linux
http://studio.zerobrane.com/
Other
2.59k stars 518 forks source link

Plugin Settings #1167

Closed sduensin closed 7 months ago

sduensin commented 7 months ago

I am attempting to add Singe (https://SingeEngine.com) support to ZeroBrane through a plugin. I need to pass some configuration information to the plugin, and according to the docs, I should be able to create a table with the plugin's name (singetoolbar.lua) in the user config like this:

singetoolbar = { something = "one", otherthing = "two" }

Then inside the plugin's onRegister function, access them like this:

local settings = self:GetSettings()
ide:Print(settings.something)
ide:Print(settings.otherthing)

However, the settings table is empty. Dumping it produces {}.

What have I done wrong? Is this me or a bug?

Thanks!

pkulchenko commented 7 months ago

@sduensin, you need to be using GetConfig instead of GetSettings. The latter is used to store and retrieve values in the settings file (for example, user selection for checkboxes in your plugin) and the former is used to retrieve values from config files.

Let me know if there is still an issue, but I'd expect it to work.

sduensin commented 7 months ago

Oh man. I went back and read the web site again... It DOES say that! Thank you! Total user error on my part. :-)

pkulchenko commented 7 months ago

No problem; glad it resolved it.