From 5fd98509cfb36a43594bd52a62be814727fe8367 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Thu, 19 Sep 2013 17:07:47 +0300 Subject: [PATCH] Script: Fix that default value is not used in Meter:GetOption --- Library/lua/glue/LuaMeasure.cpp | 9 +++++---- Library/lua/glue/LuaMeter.cpp | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Library/lua/glue/LuaMeasure.cpp b/Library/lua/glue/LuaMeasure.cpp index 61a3df94..50616bcd 100644 --- a/Library/lua/glue/LuaMeasure.cpp +++ b/Library/lua/glue/LuaMeasure.cpp @@ -40,10 +40,11 @@ static int GetOption(lua_State* L) MeterWindow* meterWindow = self->GetMeterWindow(); ConfigParser& parser = meterWindow->GetParser(); - std::wstring strTmp = LuaManager::ToWide(2); - strTmp = parser.ReadString(self->GetName(), strTmp.c_str(), LuaManager::ToWide(3).c_str()); - - LuaManager::PushWide(strTmp); + const std::wstring section = LuaManager::ToWide(2); + const std::wstring defValue = LuaManager::ToWide(3); + const std::wstring& value = + parser.ReadString(self->GetName(), section.c_str(), defValue.c_str()); + LuaManager::PushWide(value); return 1; } diff --git a/Library/lua/glue/LuaMeter.cpp b/Library/lua/glue/LuaMeter.cpp index f09aa03d..8aebb157 100644 --- a/Library/lua/glue/LuaMeter.cpp +++ b/Library/lua/glue/LuaMeter.cpp @@ -40,10 +40,11 @@ static int GetOption(lua_State* L) MeterWindow* meterWindow = self->GetMeterWindow(); ConfigParser& parser = meterWindow->GetParser(); - std::wstring strTmp = LuaManager::ToWide(2); - strTmp = parser.ReadString(self->GetName(), strTmp.c_str(), L""); - - LuaManager::PushWide(strTmp); + const std::wstring section = LuaManager::ToWide(2); + const std::wstring defValue = LuaManager::ToWide(3); + const std::wstring& value = + parser.ReadString(self->GetName(), section.c_str(), defValue.c_str()); + LuaManager::PushWide(value); return 1; }