diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-12-25 22:14:44 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-12-25 22:14:44 +0000 |
commit | 44cebe183fc13d6ced4c2eed155aa03909a542f4 (patch) | |
tree | 21ce22a23ea79e0a1269f6082ab91f9525056437 /plugins/MirLua/src/m_sounds.cpp | |
parent | 64cf90e84966b56fa3da9d01babd0387f23c8086 (diff) |
MirLua: minor fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@15942 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src/m_sounds.cpp')
-rw-r--r-- | plugins/MirLua/src/m_sounds.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/plugins/MirLua/src/m_sounds.cpp b/plugins/MirLua/src/m_sounds.cpp index 8630c53093..de2a82c23f 100644 --- a/plugins/MirLua/src/m_sounds.cpp +++ b/plugins/MirLua/src/m_sounds.cpp @@ -5,9 +5,7 @@ static int lua_AddSound(lua_State *L) ptrA name(mir_utf8decodeA(luaL_checkstring(L, 1)));
ptrT description(mir_utf8decodeT(luaL_checkstring(L, 2)));
ptrT section(mir_utf8decodeT(luaL_optstring(L, 3, MODULE)));
-
- TCHAR filePath[MAX_PATH];
- GetModuleFileName(g_hInstance, filePath, _countof(filePath));
+ ptrT filePath(mir_utf8decodeT(lua_tostring(L, 4)));
SKINSOUNDDESCEX ssd = { sizeof(SKINSOUNDDESCEX) };
ssd.pszName = name;
@@ -17,7 +15,7 @@ static int lua_AddSound(lua_State *L) ssd.ptszDefaultFile = filePath;
INT_PTR res = ::CallService("Skin/Sounds/AddNew", hLangpack, (LPARAM)&ssd);
- lua_pushnumber(L, res);
+ lua_pushboolean(L, res == 0);
return 1;
}
@@ -26,18 +24,18 @@ static int lua_PlaySound(lua_State *L) {
const char *name = luaL_checkstring(L, 1);
- INT_PTR res = SkinPlaySound(name);
- lua_pushnumber(L, res);
+ INT_PTR res = ::SkinPlaySound(name);
+ lua_pushboolean(L, res == 0);
return 1;
}
static int lua_PlayFile(lua_State *L)
{
- const char *path = luaL_checkstring(L, 1);
+ ptrT filePath(mir_utf8decodeT(luaL_checkstring(L, 1)));
- INT_PTR res = SkinPlaySoundFile(ptrT(mir_utf8decodeT(path)));
- lua_pushnumber(L, res);
+ INT_PTR res = ::SkinPlaySoundFile(filePath);
+ lua_pushboolean(L, res == 0);
return 1;
}
|