Plugin:MirLua/Module/m core: Difference between revisions
(trap -> hook; descriptor -> handle (thx Unsane)) |
Dart Raiden (talk | contribs) (Marked this version for translation) |
||
(16 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<languages/> | |||
This module is imported into global table and available in any module through variable '''m'''. It allows you to access basic features of Miranda NG core. | <translate> | ||
<!--T:1--> | |||
This module is imported into global table and available in any module through variable <tvar|var_m>'''<var>m</var>'''</>. It allows you to access basic features of Miranda NG core. | |||
</translate> | |||
__TOC__ | |||
<translate> | |||
== Constants == <!--T:2--> | |||
</translate> | |||
{| class="wikitable" | |||
|- | |||
! | |||
! scope="col" | {{Ls|Content/TableHeaders/type}} | |||
! scope="col" | {{Ls|Content/TableHeaders/description}} | |||
|- | |||
! scope="row" style="text-align:left" | {{Anchor|NULL}} NULL | |||
| style="text-align:center" | <code>light userdata</code> | |||
| <translate><!--T:3--> Null pointer.</translate> | |||
|- | |||
! scope="row" style="text-align:left" | {{Anchor|INVALID_HANDLE_VALUE}} INVALID_HANDLE_VALUE | |||
| style="text-align:center" | <code>light userdata</code> | |||
| <translate><!--T:4--> Invalid handle.</translate> | |||
|- | |||
! scope="row" style="text-align:left" | {{Anchor|CALLSERVICE_NOTFOUND}} CALLSERVICE_NOTFOUND | |||
| style="text-align:center" | <code>number</code> | |||
| <translate><!--T:5--> Result of service call when service does not exist.</translate> | |||
|- | |||
! scope="row" style="text-align:left" | Version | |||
| style="text-align:center" | <code>string</code> | |||
| | |||
|} | |||
<translate> | |||
== Named events == <!--T:6--> | |||
</translate> | |||
== | === CreateHookableEvent === | ||
<translate><!--T:7--> Creates a hookable event.</translate> | |||
=== | ==== {{Ls|MirLua/Modules/parameters}} ==== | ||
{| class="wikitable" | |||
: | |- | ||
! scope="col" | {{Ls|MirLua/Modules/param_name}} | |||
! scope="col" | {{Ls|MirLua/Modules/required_param}} | |||
! scope="col" | {{Ls|Content/TableHeaders/type}} | |||
! scope="col" | {{Ls|Content/TableHeaders/description}} | |||
|- | |||
! scope="row" class="MirLuaParametersTable-parameter" | name | |||
| style="text-align:center" | {{Ls|YesNo/yes}} | |||
| style="text-align:center" | <code>string</code> | |||
| <translate><!--T:8--> Event name.</translate> | |||
|} | |||
=== | ==== {{Ls|MirLua/Modules/result}} ==== | ||
{{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>light userdata</code> | |||
{{nbsp|5}}<translate><!--T:9--> Returns event handle if event was created successfully, otherwise <tvar|nil><code>nil</code></>.</translate> | |||
== | ==== {{Ls|MirLua/Modules/example}} ==== | ||
=== | |||
{{Content:MirLua/Example|code= | {{Content:MirLua/Example|code= | ||
local hEvent = m.CreateHookableEvent('MyEvent') | local hEvent = m.CreateHookableEvent('MyEvent') | ||
Line 38: | Line 67: | ||
end | end | ||
}} | }} | ||
---- | |||
=== HookEvent === | === HookEvent === | ||
Sets a callback function ("hook") to react to event call. Hooks are called one by one in the order they were added to the sequence. | <translate><!--T:10--> Sets a callback function ("hook") to react to event call. Hooks are called one by one in the order they were added to the sequence.</translate> | ||
Hook signature: <code>function (wParam, lParam) return 0 end</code>. | <translate><!--T:11--> Hook signature: <tvar|signature><code>function (wParam, lParam) return 0 end</code></>.</translate> | ||
Correct result for a hook is 0. When 1 is returned, the following hooks in a sequence won't be called. | <translate><!--T:12--> Correct result for a hook is <tvar|return_0><code>0</code></>. When <tvar|return_1><code>1</code></> is returned, the following hooks in a sequence won't be called.</translate> | ||
==== {{Ls|MirLua/Modules/parameters}} ==== | |||
:: | {| class="wikitable" | ||
: | |- | ||
! scope="col" | {{Ls|MirLua/Modules/param_name}} | |||
:: | ! scope="col" | {{Ls|MirLua/Modules/required_param}} | ||
: | ! scope="col" | {{Ls|Content/TableHeaders/type}} | ||
! scope="col" | {{Ls|Content/TableHeaders/description}} | |||
|- | |||
: Returns hook handle if hook was created successfully, otherwise | ! scope="row" class="MirLuaParametersTable-parameter" | name | ||
| style="text-align:center" | {{Ls|YesNo/yes}} | |||
| style="text-align:center" | <code>string</code> | |||
| <translate><!--T:13--> Event name.</translate> | |||
|- | |||
! scope="row" class="MirLuaParametersTable-parameter" | hook | |||
| style="text-align:center" | {{Ls|YesNo/yes}} | |||
| style="text-align:center" | <code>function</code> | |||
| <translate><!--T:14--> Hook function to be called when event occurs.</translate> | |||
|} | |||
==== {{Ls|MirLua/Modules/result}} ==== | |||
{{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>light userdata</code> | |||
{{nbsp|5}}<translate><!--T:15--> Returns hook handle if hook was created successfully, otherwise <tvar|nil><code>nil</code></>.</translate> | |||
==== {{Ls|MirLua/Modules/example}} ==== | |||
{{Content:MirLua/Example|code=local hHook = m.HookEvent('MyEvent', function(w, l) | {{Content:MirLua/Example|code=local hHook = m.HookEvent('MyEvent', function(w, l) | ||
print('MyEvent is raised!') | print('MyEvent is raised!') | ||
end) | end) | ||
}} | }} | ||
---- | |||
=== HookTemporaryEvent === | |||
… | |||
==== {{Ls|MirLua/Modules/parameters}} ==== | |||
{| class="wikitable" | |||
|- | |||
! scope="col" | {{Ls|MirLua/Modules/param_name}} | |||
! scope="col" | {{Ls|MirLua/Modules/required_param}} | |||
! scope="col" | {{Ls|Content/TableHeaders/type}} | |||
! scope="col" | {{Ls|Content/TableHeaders/description}} | |||
|- | |||
! scope="row" class="MirLuaParametersTable-parameter" | name | |||
| style="text-align:center" | {{Ls|YesNo/yes}} | |||
| style="text-align:center" | <code>string</code> | |||
| <translate><!--T:40--> Event name.</translate> | |||
|- | |||
! scope="row" class="MirLuaParametersTable-parameter" | hook | |||
| style="text-align:center" | {{Ls|YesNo/yes}} | |||
| style="text-align:center" | <code>function</code> | |||
| <translate><!--T:41--> Hook function to be called when event occurs.</translate> | |||
|} | |||
==== {{Ls|MirLua/Modules/result}} ==== | |||
… | |||
==== {{Ls|MirLua/Modules/example}} ==== | |||
… | |||
---- | |||
=== UnhookEvent === | === UnhookEvent === | ||
Removes hook from event call sequence. | <translate><!--T:16--> Removes hook from event call sequence.</translate> | ||
==== {{Ls|MirLua/Modules/parameters}} ==== | |||
:: | {| class="wikitable" | ||
: | |- | ||
! scope="col" | {{Ls|MirLua/Modules/param_name}} | |||
! scope="col" | {{Ls|MirLua/Modules/required_param}} | |||
: Returns | ! scope="col" | {{Ls|Content/TableHeaders/type}} | ||
! scope="col" | {{Ls|Content/TableHeaders/description}} | |||
|- | |||
! scope="row" class="MirLuaParametersTable-parameter" | hEvent | |||
| style="text-align:center" | {{Ls|YesNo/yes}} | |||
| style="text-align:center" | <code>light userdata</code> | |||
| <translate><!--T:17--> Event handle received on <tvar|CreateHookableEvent>[[#CreateHookableEvent|CreateHookableEvent]]</> call.</translate> | |||
|} | |||
==== {{Ls|MirLua/Modules/result}} ==== | |||
{{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>boolean</code> | |||
{{nbsp|5}}<translate><!--T:18--> Returns <tvar|true><code>true</code></> if hook function was removed successfully, otherwise <tvar|false><code>false</code></>.</translate> | |||
==== {{Ls|MirLua/Modules/example}} ==== | |||
{{Content:MirLua/Example|code=m.UnhookEvent(hHook)}} | {{Content:MirLua/Example|code=m.UnhookEvent(hHook)}} | ||
---- | |||
=== NotifyEventHooks === | === NotifyEventHooks === | ||
Calls all hooks of event call sequence one by one. | <translate><!--T:19--> Calls all hooks of event call sequence one by one.</translate> | ||
==== {{Ls|MirLua/Modules/parameters}} ==== | |||
:: | {| class="wikitable" | ||
: | |- | ||
: | ! scope="col" | {{Ls|MirLua/Modules/param_name}} | ||
: | ! scope="col" | {{Ls|MirLua/Modules/required_param}} | ||
! scope="col" | {{Ls|Content/TableHeaders/type}} | |||
: | ! scope="col" | {{Ls|Content/TableHeaders/description}} | ||
: Returns | |- | ||
! scope="row" class="MirLuaParametersTable-parameter" | hEvent | |||
| style="text-align:center" | {{Ls|YesNo/yes}} | |||
| style="text-align:center" | <code>light userdata</code> | |||
| <translate><!--T:20--> Event handle received on <tvar|CreateHookableEvent>[[#CreateHookableEvent|CreateHookableEvent]]</> call.</translate> | |||
|- | |||
! scope="row" class="MirLuaParametersTable-parameter" | wParam | |||
| style="text-align:center" | {{Ls|YesNo/no}} | |||
| style="text-align:center" | | |||
| | |||
|- | |||
! scope="row" class="MirLuaParametersTable-parameter" | lParam | |||
| style="text-align:center" | {{Ls|YesNo/no}} | |||
| style="text-align:center" | | |||
| | |||
|} | |||
==== {{Ls|MirLua/Modules/result}} ==== | |||
{{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>boolean</code> | |||
{{nbsp|5}}<translate><!--T:21--> Returns <tvar|true><code>true</code></> if all hooks were called, otherwise <tvar|false><code>false</code></>.</translate> | |||
==== {{Ls|MirLua/Modules/example}} ==== | |||
{{Content:MirLua/Example|code=m.NotifyEventHooks(hEvent)}} | {{Content:MirLua/Example|code=m.NotifyEventHooks(hEvent)}} | ||
<translate> | |||
== Named service functions == <!--T:22--> | |||
</translate> | |||
=== CreateServiceFunction === | === CreateServiceFunction === | ||
Creates a service function ("service") | <translate><!--T:23--> Creates a service function ("service").</translate> | ||
==== {{Ls|MirLua/Modules/parameters}} ==== | |||
:: | {| class="wikitable" | ||
: | |- | ||
! scope="col" | {{Ls|MirLua/Modules/param_name}} | |||
! scope="col" | {{Ls|MirLua/Modules/required_param}} | |||
: Returns service handle if service was created successfully, otherwise | ! scope="col" | {{Ls|Content/TableHeaders/type}} | ||
! scope="col" | {{Ls|Content/TableHeaders/description}} | |||
|- | |||
! scope="row" class="MirLuaParametersTable-parameter" | name | |||
| style="text-align:center" | {{Ls|YesNo/yes}} | |||
| style="text-align:center" | <code>string</code> | |||
| <translate><!--T:24--> Service name.</translate> | |||
|} | |||
==== {{Ls|MirLua/Modules/result}} ==== | |||
{{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>light userdata</code> | |||
{{nbsp|5}}<translate><!--T:25--> Returns service handle if service was created successfully, otherwise <tvar|nil><code>nil</code></>.</translate> | |||
==== {{Ls|MirLua/Modules/example}} ==== | |||
{{Content:MirLua/Example|code=local hService = m.CreateServiceFunction('MyService', function(w, l) | {{Content:MirLua/Example|code=local hService = m.CreateServiceFunction('MyService', function(w, l) | ||
print('MyServiceis called!') | print('MyServiceis called!') | ||
end) | end) | ||
}} | }} | ||
---- | |||
=== CallService === | === CallService === | ||
Calls service with parameters. | <translate><!--T:26--> Calls service with parameters.</translate> | ||
==== {{Ls|MirLua/Modules/parameters}} ==== | |||
:: | {| class="wikitable" | ||
: | |- | ||
: | ! scope="col" | {{Ls|MirLua/Modules/param_name}} | ||
: | ! scope="col" | {{Ls|MirLua/Modules/required_param}} | ||
! scope="col" | {{Ls|Content/TableHeaders/type}} | |||
: | ! scope="col" | {{Ls|Content/TableHeaders/description}} | ||
: Returns result of service execution or [[#CALLSERVICE_NOTFOUND|CALLSERVICE_NOTFOUND]] | |- | ||
! scope="row" class="MirLuaParametersTable-parameter" | name | |||
| style="text-align:center" | {{Ls|YesNo/yes}} | |||
| style="text-align:center" | <code>string</code> | |||
| <translate><!--T:27--> Service name.</translate> | |||
|- | |||
! scope="row" class="MirLuaParametersTable-parameter" | wParam | |||
| style="text-align:center" | {{Ls|YesNo/no}} | |||
| style="text-align:center" | | |||
| | |||
|- | |||
! scope="row" class="MirLuaParametersTable-parameter" | lParam | |||
| style="text-align:center" | {{Ls|YesNo/no}} | |||
| style="text-align:center" | | |||
| | |||
|} | |||
==== {{Ls|MirLua/Modules/result}} ==== | |||
{{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>number</code> | |||
{{nbsp|5}}<translate><!--T:28--> Returns result of service execution or <tvar|CALLSERVICE_NOTFOUND>[[#CALLSERVICE_NOTFOUND|CALLSERVICE_NOTFOUND]]</>.</translate> | |||
==== {{Ls|MirLua/Modules/example}} ==== | |||
{{Content:MirLua/Example|code= | {{Content:MirLua/Example|code= | ||
local result = m.CallService('MyService') | local result = m.CallService('MyService') | ||
Line 122: | Line 269: | ||
end | end | ||
}} | }} | ||
---- | |||
=== ServiceExists === | === ServiceExists === | ||
Checks if service exists by its name. | <translate><!--T:29--> Checks if service exists by its name.</translate> | ||
==== {{Ls|MirLua/Modules/parameters}} ==== | |||
:: | {| class="wikitable" | ||
: | |- | ||
! scope="col" | {{Ls|MirLua/Modules/param_name}} | |||
! scope="col" | {{Ls|MirLua/Modules/required_param}} | |||
: Returns | ! scope="col" | {{Ls|Content/TableHeaders/type}} | ||
! scope="col" | {{Ls|Content/TableHeaders/description}} | |||
|- | |||
! scope="row" class="MirLuaParametersTable-parameter" | name | |||
| style="text-align:center" | {{Ls|YesNo/yes}} | |||
| style="text-align:center" | <code>string</code> | |||
| <translate><!--T:30--> Service name.</translate> | |||
|} | |||
==== {{Ls|MirLua/Modules/result}} ==== | |||
{{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>boolean</code> | |||
{{nbsp|5}}<translate><!--T:31--> Returns <tvar|true><code>true</code></> if service exists, otherwise <tvar|false><code>false</code></>.</translate> | |||
==== {{Ls|MirLua/Modules/example}} ==== | |||
{{Content:MirLua/Example|code=if m.ServiceExists('MyService') then | {{Content:MirLua/Example|code=if m.ServiceExists('MyService') then | ||
m.CallService('MyService') | m.CallService('MyService') | ||
end}} | end}} | ||
---- | |||
=== DestroyServiceFunction === | === DestroyServiceFunction === | ||
Destroys a service function. | <translate><!--T:32--> Destroys a service function.</translate> | ||
==== {{Ls|MirLua/Modules/parameters}} ==== | |||
:: | {| class="wikitable" | ||
: | |- | ||
! scope="col" | {{Ls|MirLua/Modules/param_name}} | |||
! scope="col" | {{Ls|MirLua/Modules/required_param}} | |||
! scope="col" | {{Ls|Content/TableHeaders/type}} | |||
! scope="col" | {{Ls|Content/TableHeaders/description}} | |||
|- | |||
! scope="row" class="MirLuaParametersTable-parameter" | hService | |||
| style="text-align:center" | {{Ls|YesNo/yes}} | |||
| style="text-align:center" | <code>light userdata</code> | |||
| <translate><!--T:33--> Service handle received on <tvar|CreateServiceFunction>[[#CreateServiceFunction|CreateServiceFunction]]</> call.</translate> | |||
|} | |||
==== {{Ls|MirLua/Modules/example}} ==== | |||
{{Content:MirLua/Example|code=m.DestroyServiceFunction(hService)}} | {{Content:MirLua/Example|code=m.DestroyServiceFunction(hService)}} | ||
<translate> | |||
== Threads == <!--T:42--> | |||
</translate> | |||
=== ForkThread === | |||
… | |||
---- | |||
=== TerminateThread === | |||
… | |||
<translate> | |||
== Other == <!--T:34--> | |||
</translate> | |||
=== IsPluginLoaded === | === IsPluginLoaded === | ||
Checks | <translate><!--T:35--> Checks using UUID of the plugin whether it is loaded.</translate> | ||
==== {{Ls|MirLua/Modules/parameters}} ==== | |||
:: | {| class="wikitable" | ||
: | |- | ||
! scope="col" | {{Ls|MirLua/Modules/param_name}} | |||
! scope="col" | {{Ls|MirLua/Modules/required_param}} | |||
: Returns | ! scope="col" | {{Ls|Content/TableHeaders/type}} | ||
! scope="col" | {{Ls|Content/TableHeaders/description}} | |||
|- | |||
! scope="row" class="MirLuaParametersTable-parameter" | uuid | |||
| style="text-align:center" | {{Ls|YesNo/yes}} | |||
| style="text-align:center" | <code>string</code> | |||
| <translate><!--T:36--> Plugin UUID in format <tvar|uuid_format>''<code>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</code>''</>.</translate> | |||
|} | |||
==== {{Ls|MirLua/Modules/result}} ==== | |||
{{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>boolean</code> | |||
{{nbsp|5}}<translate><!--T:37--> Returns <tvar|true><code>true</code></> if plugin is loaded, otherwise <tvar|false><code>false</code></>.</translate> | |||
==== {{Ls|MirLua/Modules/example}} ==== | |||
{{Content:MirLua/Example|code=if m.IsPluginLoaded('{F0FDF73A-753D-499d-8DBA-336DB79CDD41}') then | {{Content:MirLua/Example|code=if m.IsPluginLoaded('{F0FDF73A-753D-499d-8DBA-336DB79CDD41}') then | ||
print('Advanced auto away plugin is loaded!') | print('Advanced auto away plugin is loaded!') | ||
end | end | ||
}} | }} | ||
---- | |||
=== Free === | |||
… | |||
---- | |||
=== Translate === | |||
<translate><!--T:38--> Translates a string into the language of the current langpack.</translate> | |||
=== | ==== {{Ls|MirLua/Modules/parameters}} ==== | ||
{| class="wikitable" | |||
|- | |||
! scope="col" | {{Ls|MirLua/Modules/param_name}} | |||
! scope="col" | {{Ls|MirLua/Modules/required_param}} | |||
! scope="col" | {{Ls|Content/TableHeaders/type}} | |||
! scope="col" | {{Ls|Content/TableHeaders/description}} | |||
{{Content | |- | ||
! scope="row" class="MirLuaParametersTable-parameter" | text | |||
| style="text-align:center" | {{Ls|YesNo/yes}} | |||
| style="text-align:center" | <code>string</code> | |||
| | |||
|} | |||
=== | ==== {{Ls|MirLua/Modules/result}} ==== | ||
{{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>string</code> | |||
{{ | |||
=== | ==== {{Ls|MirLua/Modules/example}} ==== | ||
{{Content:MirLua/Example|code=m.Translate('Exit')}} | {{Content:MirLua/Example|code=m.Translate('Exit')}} | ||
---- | |||
=== Parse === | |||
<translate><!--T:39--> Replaces Miranda NG variables in a string.</translate> | |||
{| class="wikitable" | |||
|- | |||
! scope="col" | {{Ls|MirLua/Modules/param_name}} | |||
! scope="col" | {{Ls|MirLua/Modules/required_param}} | |||
! scope="col" | {{Ls|Content/TableHeaders/type}} | |||
! scope="col" | {{Ls|Content/TableHeaders/description}} | |||
|- | |||
! scope="row" class="MirLuaParametersTable-parameter" | text | |||
| style="text-align:center" | {{Ls|YesNo/yes}} | |||
| style="text-align:center" | <code>string</code> | |||
| | |||
|} | |||
==== {{Ls|MirLua/Modules/result}} ==== | |||
{{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>string</code> | |||
=== | ==== {{Ls|MirLua/Modules/example}} ==== | ||
{{Content:MirLua/Example|code=local profileName = m.ReplaceVariables('%miranda_profilename%')}} | {{Content:MirLua/Example|code=local profileName = m.ReplaceVariables('%miranda_profilename%')}} | ||
---- | |||
=== GetFullPath === | |||
… |
Latest revision as of 02:00, 10 February 2022
This module is imported into global table and available in any module through variable m. It allows you to access basic features of Miranda NG core.
Constants
Type | Description | |
---|---|---|
NULL | light userdata
|
Null pointer. |
INVALID_HANDLE_VALUE | light userdata
|
Invalid handle. |
CALLSERVICE_NOTFOUND | number
|
Result of service call when service does not exist. |
Version | string
|
Named events
CreateHookableEvent
Creates a hookable event.
Parameters
Parameter name | Required | Type | Description |
---|---|---|---|
name | Yes | string
|
Event name. |
Result
Type: light userdata
Returns event handle if event was created successfully, otherwise nil
.
Example
local hEvent = m.CreateHookableEvent('MyEvent')
if hEvent == m.NULL then
print('Event handle is empty!')
end
HookEvent
Sets a callback function ("hook") to react to event call. Hooks are called one by one in the order they were added to the sequence.
Hook signature: function (wParam, lParam) return 0 end
.
Correct result for a hook is 0
. When 1
is returned, the following hooks in a sequence won't be called.
Parameters
Parameter name | Required | Type | Description |
---|---|---|---|
name | Yes | string
|
Event name. |
hook | Yes | function
|
Hook function to be called when event occurs. |
Result
Type: light userdata
Returns hook handle if hook was created successfully, otherwise nil
.
Example
local hHook = m.HookEvent('MyEvent', function(w, l)
print('MyEvent is raised!')
end)
HookTemporaryEvent
…
Parameters
Parameter name | Required | Type | Description |
---|---|---|---|
name | Yes | string
|
Event name. |
hook | Yes | function
|
Hook function to be called when event occurs. |
Result
…
Example
…
UnhookEvent
Removes hook from event call sequence.
Parameters
Parameter name | Required | Type | Description |
---|---|---|---|
hEvent | Yes | light userdata
|
Event handle received on CreateHookableEvent call. |
Result
Type: boolean
Returns true
if hook function was removed successfully, otherwise false
.
Example
m.UnhookEvent(hHook)
NotifyEventHooks
Calls all hooks of event call sequence one by one.
Parameters
Parameter name | Required | Type | Description |
---|---|---|---|
hEvent | Yes | light userdata
|
Event handle received on CreateHookableEvent call. |
wParam | No | ||
lParam | No |
Result
Type: boolean
Returns true
if all hooks were called, otherwise false
.
Example
m.NotifyEventHooks(hEvent)
Named service functions
CreateServiceFunction
Creates a service function ("service").
Parameters
Parameter name | Required | Type | Description |
---|---|---|---|
name | Yes | string
|
Service name. |
Result
Type: light userdata
Returns service handle if service was created successfully, otherwise nil
.
Example
local hService = m.CreateServiceFunction('MyService', function(w, l)
print('MyServiceis called!')
end)
CallService
Calls service with parameters.
Parameters
Parameter name | Required | Type | Description |
---|---|---|---|
name | Yes | string
|
Service name. |
wParam | No | ||
lParam | No |
Result
Type: number
Returns result of service execution or CALLSERVICE_NOTFOUND.
Example
local result = m.CallService('MyService')
if result == m.CALLSERVICE_NOTFOUND then
print('Service is not found!')
end
ServiceExists
Checks if service exists by its name.
Parameters
Parameter name | Required | Type | Description |
---|---|---|---|
name | Yes | string
|
Service name. |
Result
Type: boolean
Returns true
if service exists, otherwise false
.
Example
if m.ServiceExists('MyService') then
m.CallService('MyService')
end
DestroyServiceFunction
Destroys a service function.
Parameters
Parameter name | Required | Type | Description |
---|---|---|---|
hService | Yes | light userdata
|
Service handle received on CreateServiceFunction call. |
Example
m.DestroyServiceFunction(hService)
Threads
ForkThread
…
TerminateThread
…
Other
IsPluginLoaded
Checks using UUID of the plugin whether it is loaded.
Parameters
Parameter name | Required | Type | Description |
---|---|---|---|
uuid | Yes | string
|
Plugin UUID in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx .
|
Result
Type: boolean
Returns true
if plugin is loaded, otherwise false
.
Example
if m.IsPluginLoaded('{F0FDF73A-753D-499d-8DBA-336DB79CDD41}') then
print('Advanced auto away plugin is loaded!')
end
Free
…
Translate
Translates a string into the language of the current langpack.
Parameters
Parameter name | Required | Type | Description |
---|---|---|---|
text | Yes | string
|
Result
Type: string
Example
m.Translate('Exit')
Parse
Replaces Miranda NG variables in a string.
Parameter name | Required | Type | Description |
---|---|---|---|
text | Yes | string
|
Result
Type: string
Example
local profileName = m.ReplaceVariables('%miranda_profilename%')
GetFullPath
…