Script: Fix that default value is not used in Meter:GetOption

This commit is contained in:
Birunthan Mohanathas 2013-09-19 17:07:47 +03:00
parent 08eb662e1f
commit 5fd98509cf
2 changed files with 10 additions and 8 deletions

View File

@ -40,10 +40,11 @@ static int GetOption(lua_State* L)
MeterWindow* meterWindow = self->GetMeterWindow(); MeterWindow* meterWindow = self->GetMeterWindow();
ConfigParser& parser = meterWindow->GetParser(); ConfigParser& parser = meterWindow->GetParser();
std::wstring strTmp = LuaManager::ToWide(2); const std::wstring section = LuaManager::ToWide(2);
strTmp = parser.ReadString(self->GetName(), strTmp.c_str(), LuaManager::ToWide(3).c_str()); const std::wstring defValue = LuaManager::ToWide(3);
const std::wstring& value =
LuaManager::PushWide(strTmp); parser.ReadString(self->GetName(), section.c_str(), defValue.c_str());
LuaManager::PushWide(value);
return 1; return 1;
} }

View File

@ -40,10 +40,11 @@ static int GetOption(lua_State* L)
MeterWindow* meterWindow = self->GetMeterWindow(); MeterWindow* meterWindow = self->GetMeterWindow();
ConfigParser& parser = meterWindow->GetParser(); ConfigParser& parser = meterWindow->GetParser();
std::wstring strTmp = LuaManager::ToWide(2); const std::wstring section = LuaManager::ToWide(2);
strTmp = parser.ReadString(self->GetName(), strTmp.c_str(), L""); const std::wstring defValue = LuaManager::ToWide(3);
const std::wstring& value =
LuaManager::PushWide(strTmp); parser.ReadString(self->GetName(), section.c_str(), defValue.c_str());
LuaManager::PushWide(value);
return 1; return 1;
} }