This commit is contained in:
Birunthan Mohanathas 2013-01-27 12:17:38 +02:00
parent fdcd5a9757
commit 438f79bf5d
5 changed files with 14 additions and 7 deletions

View File

@ -75,8 +75,14 @@ void LuaManager::ReportErrors(lua_State* L, const std::wstring& file)
void LuaManager::PushWide(lua_State* L, const WCHAR* str)
{
const std::string tmpStr = StringUtil::Narrow(str);
lua_pushlstring(L, tmpStr.c_str(), tmpStr.length());
const std::string narrowStr = StringUtil::Narrow(str);
lua_pushlstring(L, narrowStr.c_str(), narrowStr.length());
}
void LuaManager::PushWide(lua_State* L, const std::wstring& str)
{
const std::string narrowStr = StringUtil::Narrow(str);
lua_pushlstring(L, narrowStr.c_str(), narrowStr.length());
}
std::wstring LuaManager::ToWide(lua_State* L, int narg)

View File

@ -37,6 +37,7 @@ public:
static void ReportErrors(lua_State* L, const std::wstring& file);
static void PushWide(lua_State* L, const WCHAR* str);
static void PushWide(lua_State* L, const std::wstring& str);
static std::wstring ToWide(lua_State* L, int narg);
protected:

View File

@ -43,7 +43,7 @@ static int GetOption(lua_State* L)
std::wstring strTmp = LuaManager::ToWide(L, 2);
strTmp = parser.ReadString(self->GetName(), strTmp.c_str(), LuaManager::ToWide(L, 3).c_str());
LuaManager::PushWide(L, strTmp.c_str());
LuaManager::PushWide(L, strTmp);
return 1;
}

View File

@ -43,7 +43,7 @@ static int GetOption(lua_State* L)
std::wstring strTmp = LuaManager::ToWide(L, 2);
strTmp = parser.ReadString(self->GetName(), strTmp.c_str(), L"");
LuaManager::PushWide(L, strTmp.c_str());
LuaManager::PushWide(L, strTmp);
return 1;
}

View File

@ -111,7 +111,7 @@ static int GetVariable(lua_State* L)
const std::wstring* value = self->GetParser().GetVariable(strTmp);
if (value)
{
LuaManager::PushWide(L, (*value).c_str());
LuaManager::PushWide(L, *value);
}
else
{
@ -128,7 +128,7 @@ static int ReplaceVariables(lua_State* L)
self->GetParser().ReplaceVariables(strTmp);
self->GetParser().ReplaceMeasures(strTmp);
LuaManager::PushWide(L, strTmp.c_str());
LuaManager::PushWide(L, strTmp);
return 1;
}
@ -206,7 +206,7 @@ static int MakePathAbsolute(lua_State* L)
DECLARE_SELF(L)
std::wstring path = LuaManager::ToWide(L, 2);
self->MakePathAbsolute(path);
LuaManager::PushWide(L, path.c_str());
LuaManager::PushWide(L, path);
return 1;
}