summaryrefslogtreecommitdiff
path: root/plugins/MirLua/docs/examples/core.lua
blob: d72ce0c18f04d732c7c3dffee7aab47db746c4b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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')

-- 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)