diff --git a/plugin_loader.py b/plugin_loader.py index 783f389..1087400 100644 --- a/plugin_loader.py +++ b/plugin_loader.py @@ -17,11 +17,18 @@ class PluginLoader(Window): start_open=True ) - self.lua_runtime = lua51.LuaRuntime() - @work async def find_plugins(self): log = self.query_one(RichLog) + + log.write("[b]Setting up LUA runtime..[/]") + self.lua_runtime = lua51.LuaRuntime() + lua_runtime_stuff = { + "ui": { + "notify": self.notify + } + } + log.write("[b]Finding plugins...[/]") # Find all plugins (they're just in the plugins folder for now) @@ -83,6 +90,7 @@ class PluginLoader(Window): sandbox.print = self.log #self.lua_runtime.globals().print sandbox.math = self.lua_runtime.globals().math sandbox.string = self.lua_runtime.globals().string + sandbox.berry = lua_runtime_stuff setfenv(0, sandbox) executed_code = self.lua_runtime.execute(code) diff --git a/plugins/test-plugin/lua/main.lua b/plugins/test-plugin/lua/main.lua index 0ea2c7b..47f010f 100644 --- a/plugins/test-plugin/lua/main.lua +++ b/plugins/test-plugin/lua/main.lua @@ -1,6 +1,7 @@ local plugin = {} function plugin.init() + berry.ui.notify("hiiii") end function plugin.main()