Plugin:MirLua/Module/m core/de: Difference between revisions
Wishmaster (talk | contribs) Created page with "Gibt das Ergebnis des Service-Aufrufes zurück oder $CALLSERVICE_NOTFOUND." |
Wishmaster (talk | contribs) Created page with "Dienstname." |
||
| Line 241: | Line 241: | ||
| style="text-align:center" | {{Ls|YesNo/yes}} | | style="text-align:center" | {{Ls|YesNo/yes}} | ||
| style="text-align:center" | <code>string</code> | | style="text-align:center" | <code>string</code> | ||
| | | Dienstname. | ||
|} | |} | ||
Revision as of 13:35, 2 June 2018
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.
Konstanten
| Typ | Beschreibung | |
|---|---|---|
| NULL | light userdata
|
Null-Pointer. |
| INVALID_HANDLE_VALUE | light userdata
|
Ungültiger Handle. |
| CALLSERVICE_NOTFOUND | number
|
Ergebnis eines Serviceaufrufes wenn Service nicht existiert. |
Benannte Ereignisse
CreateHookableEvent
Creates a hookable event.
Parameter
| Parametername | Benötigt | Typ | Beschreibung |
|---|---|---|---|
| name | Ja | string
|
Ereignisname. |
Ergebnis
Typ:: light userdata
Returns event handle if event was created successfully, otherwise nil.
Beispiel
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.
Parameter
| Parametername | Benötigt | Typ | Beschreibung |
|---|---|---|---|
| name | Ja | string
|
Ereignisname. |
| hook | Ja | function
|
Hook function to be called when event occurs. |
Ergebnis
Typ:: light userdata
Returns hook handle if hook was created successfully, otherwise nil.
Beispiel
local hHook = m.HookEvent('MyEvent', function(w, l)
print('MyEvent is raised!')
end)
UnhookEvent
Removes hook from event call sequence.
Parameter
| Parametername | Benötigt | Typ | Beschreibung |
|---|---|---|---|
| hEvent | Ja | light userdata
|
Event handle received on CreateHookableEvent call. |
Ergebnis
Typ:: boolean
Returns true if hook function was removed successfully, otherwise false.
Beispiel
m.UnhookEvent(hHook)
NotifyEventHooks
Calls all hooks of event call sequence one by one.
Parameter
| Parametername | Benötigt | Typ | Beschreibung |
|---|---|---|---|
| hEvent | Ja | light userdata
|
Event handle received on CreateHookableEvent call. |
| wParam | Nein | ||
| lParam | Nein |
Ergebnis
Typ:: boolean
Returns true if all hooks were called, otherwise false.
Beispiel
m.NotifyEventHooks(hEvent)
Benannte Servicefunktionen
CreateServiceFunction
Creates a service function ("service").
Parameter
| Parametername | Benötigt | Typ | Beschreibung |
|---|---|---|---|
| name | Ja | string
|
Dienstname. |
Ergebnis
Typ:: light userdata
Returns service handle if service was created successfully, otherwise nil.
Beispiel
local hService = m.CreateServiceFunction('MyService', function(w, l)
print('MyServiceis called!')
end)
CallService
Calls service with parameters.
Parameter
| Parametername | Benötigt | Typ | Beschreibung |
|---|---|---|---|
| name | Ja | string
|
Dienstname. |
| wParam | Nein | ||
| lParam | Nein |
Ergebnis
Typ:: number
Gibt das Ergebnis des Service-Aufrufes zurück oder CALLSERVICE_NOTFOUND.
Beispiel
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.
Parameter
| Parametername | Benötigt | Typ | Beschreibung |
|---|---|---|---|
| name | Ja | string
|
Dienstname. |
Ergebnis
Typ:: boolean
Returns true if service exists, otherwise false.
Beispiel
if m.ServiceExists('MyService') then
m.CallService('MyService')
end
DestroyServiceFunction
Destroys a service function.
Parameter
| Parametername | Benötigt | Typ | Beschreibung |
|---|---|---|---|
| hService | Ja | light userdata
|
Service handle received on CreateServiceFunction call. |
Beispiel
m.DestroyServiceFunction(hService)
Andere
IsPluginLoaded
Checks using UUID of the plugin whether it is loaded.
Parameter
| Parametername | Benötigt | Typ | Beschreibung |
|---|---|---|---|
| uuid | Ja | string
|
Plugin UUID in format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
|
Ergebnis
Typ:: boolean
Returns true if plugin is loaded, otherwise false.
Beispiel
if m.IsPluginLoaded('{F0FDF73A-753D-499d-8DBA-336DB79CDD41}') then
print('Advanced auto away plugin is loaded!')
end
Translate
Translates a string into the language of the current langpack.
Parameter
| Parametername | Benötigt | Typ | Beschreibung |
|---|---|---|---|
| text | Ja | string
|
Ergebnis
Typ:: string
Beispiel
m.Translate('Exit')
Parse
Replaces Miranda NG variables in a string.
| Parametername | Benötigt | Typ | Beschreibung |
|---|---|---|---|
| text | Ja | string
|
Ergebnis
Typ:: string
Beispiel
local profileName = m.ReplaceVariables('%miranda_profilename%')