diff options
author | aunsane <aunsane@gmail.com> | 2018-06-15 21:35:15 +0300 |
---|---|---|
committer | aunsane <aunsane@gmail.com> | 2018-06-27 21:45:11 +0300 |
commit | 5a766d7cce12012a3b27d899b6c7f7d24a776f8c (patch) | |
tree | 8bec5f2bf6d6d3441d2f5c20726a01f9540fe6f0 /plugins | |
parent | 2942b6d842c30ac28bf0e77904adffdd8582775a (diff) |
MirLua: code cleaning
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/MirLua/src/Modules/m_database.cpp | 8 | ||||
-rw-r--r-- | plugins/MirLua/src/utils.cpp | 6 |
2 files changed, 5 insertions, 9 deletions
diff --git a/plugins/MirLua/src/Modules/m_database.cpp b/plugins/MirLua/src/Modules/m_database.cpp index 3b82fbc9da..21b87c0274 100644 --- a/plugins/MirLua/src/Modules/m_database.cpp +++ b/plugins/MirLua/src/Modules/m_database.cpp @@ -19,17 +19,15 @@ void luaM_pushdbvt(lua_State *L, const DBVARIANT &value) lua_pushstring(L, value.pszVal); break; case DBVT_WCHAR: - lua_pushstring(L, ptrA(mir_utf8encodeW(value.pwszVal))); + lua_pushstring(L, T2Utf(value.pwszVal)); break; case DBVT_BLOB: - { lua_createtable(L, value.cpbVal, 0); for (int i = 0; i < value.cpbVal; i++) { lua_pushinteger(L, value.pbVal[i]); lua_rawseti(L, -2, i + 1); } - } - break; + break; default: lua_pushnil(L); } @@ -545,8 +543,8 @@ static int db_WriteSetting(lua_State *L) dbv.pbVal[i] = lua_tointeger(L, -1); lua_pop(L, 1); } - } break; + } default: lua_pushboolean(L, false); return 1; diff --git a/plugins/MirLua/src/utils.cpp b/plugins/MirLua/src/utils.cpp index c0c74a76fa..cc75303af7 100644 --- a/plugins/MirLua/src/utils.cpp +++ b/plugins/MirLua/src/utils.cpp @@ -75,15 +75,13 @@ int luaM_getenv(lua_State *L) lua_Debug ar; if (lua_getstack(L, 1, &ar) == 0 || lua_getinfo(L, "f", &ar) == 0 || - lua_iscfunction(L, -1)) - { + lua_iscfunction(L, -1)) { lua_pop(L, 1); return 0; } const char *env = lua_getupvalue(L, -1, 1); - if (!env || strcmp(env, "_ENV") != 0) - { + if (!env || strcmp(env, "_ENV") != 0) { lua_pop(L, 1); return 0; } |