Plugin:MirLua/Module/m sounds: Difference between revisions
Jump to navigation
Jump to search
(correct target of localized string after change (to be 'required_param' now)) |
(turning AddSound parameters into table - first iteration) |
||
Line 15: | Line 15: | ||
==== {{Ls|MirLua/Modules/parameters}} ==== | ==== {{Ls|MirLua/Modules/parameters}} ==== | ||
{| class="wikitable" | |||
|+ {{Ls|MirLua/Modules/parameters}} | |||
|- | |||
! scope="col" | {{Ls|MirLua/Modules/param_name}} | |||
! scope="col" | {{Ls|MirLua/Modules/required_param}} | |||
: | ! scope="col" | {{Ls|MirLua/Modules/type}} | ||
! scope="col" | Description | |||
|- | |||
! scope="row" style="text-align:left" | name | |||
:: | | style="text-align:center" | yes | ||
| style="text-align:center" | <code>string</code> | |||
| <translate><!--T:4--> Unique name.</translate> | |||
|- | |||
:: | ! scope="row" style="text-align:left" | description | ||
| style="text-align:center" | yes | |||
| style="text-align:center" | <code>string</code> | |||
| <translate><!--T:5--> Description.</translate> | |||
|- | |||
! scope="row" style="text-align:left" | section | |||
| style="text-align:center" | no | |||
| style="text-align:center" | <code>string</code> | |||
| <translate><!--T:6--> Section name in Miranda sound settings. By default plugin name (<tvar|default_name>''MirLua''</>) is used.</translate> | |||
|- | |||
! scope="row" style="text-align:left" | path | |||
| style="text-align:center" | no | |||
| style="text-align:center" | <code>string</code> | |||
| <translate><!--T:7--> Path to sound file.</translate> | |||
|} | |||
==== {{Ls|MirLua/Modules/result}} ==== | ==== {{Ls|MirLua/Modules/result}} ==== |
Revision as of 17:50, 31 May 2018
Allows you to work with sounds.
Include module:: local sounds = require('m_sounds')
Functions
AddSound
Registers a sound.
Parameters
Parameter name | Required | Type: | Description |
---|---|---|---|
name | yes | string
|
Unique name. |
description | yes | string
|
Description. |
section | no | string
|
Section name in Miranda sound settings. By default plugin name (MirLua) is used. |
path | no | string
|
Path to sound file. |
Result
Type:: boolean
Returns true
if sound was registered successfully, otherwise false
.
Example
local hIcon = sounds.AddSound('soundUniqueName', 'My super icon')
PlaySound
Plays sound by its unique name.
Parameters
- name (Required)
-
- Type::
string
- Unique name.
- Type::
Result
Type:: boolean
Returns true
if sound was played successfully, otherwise false
.
Example
sounds.PlaySound('soundUniqueName')
PlayFile
Plays sound from file.
Parameters
- path (Required)
-
- Type::
string
- Path to file.
- Type::
Result
Type:: boolean
Returns true
if sound was played successfully, otherwise false
.
Example
sounds.PlayFile('c:\\lambada.wav')