summaryrefslogtreecommitdiff
path: root/plugins/MirLua/docs/examples/core.lua
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-07-06 14:16:46 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-07-06 14:16:46 +0000
commitebf6fb13279e64a24b739ed0d6ed85369559d32c (patch)
tree488d3bf57deb1305d91c5323854ea251eec6b86b /plugins/MirLua/docs/examples/core.lua
parent044f684c197b7dc71556b2c26415cdc694ba51a3 (diff)
MirLua: fixed m_core examples
git-svn-id: http://svn.miranda-ng.org/main/trunk@14499 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/docs/examples/core.lua')
-rw-r--r--plugins/MirLua/docs/examples/core.lua15
1 files changed, 13 insertions, 2 deletions
diff --git a/plugins/MirLua/docs/examples/core.lua b/plugins/MirLua/docs/examples/core.lua
index 5e253ea0d2..d72ce0c18f 100644
--- a/plugins/MirLua/docs/examples/core.lua
+++ b/plugins/MirLua/docs/examples/core.lua
@@ -1,11 +1,22 @@
-- core module (m) is included by default
--- include m_clist module
local clist = require('m_clist')
+--- include m_genmenu module
+local genmenu = require('m_genmenu')
-- include m_icolib module
local icolib = require('m_icolib')
-- Add icon for menu items
local hRestartIcon = icolib.AddIcon('restartIcon', 'Restart')
--- Add menu item to main menu that allow to restart Miranda NG
-clist.AddMainMenuItem("Restart", 0, 0, hRestartIcon, "Miranda/System/Restart")
+-- Subscribe to Lua script loaded event
+m.OnScriptLoaded(function()
+ -- Add menu item to main menu that allow to restart Miranda NG
+ hRestartMenuItem = clist.AddMainMenuItem({ Name = "Restart", Icon = hRestartIcon, Service = "Miranda/System/Restart" })
+end)
+
+-- Subscribe to Lua script unload event
+m.OnScriptUnload(function()
+ -- remove menu item from main menu
+ hRestartMenuItem = genmenu.RemoveMenuItem(hRestart)
+end)