Script: Add Unicode support

If the script file is UTF-8 encoded, all Lua strings are converted to/from as if they were UTF-8. Otherwise things continue to work as they have until now. Additionally, UTF-8 scripts cannot use deprecated features at all (PROPERTIES, GetStringValue).
This commit is contained in:
Birunthan Mohanathas
2013-08-06 20:43:57 +03:00
parent 5fcf4b785d
commit 6560518037
8 changed files with 121 additions and 93 deletions

View File

@ -29,7 +29,7 @@
static int GetName(lua_State* L)
{
DECLARE_SELF(L)
LuaManager::PushWide(L, self->GetName());
LuaManager::PushWide(self->GetName());
return 1;
}
@ -40,10 +40,10 @@ static int GetOption(lua_State* L)
MeterWindow* meterWindow = self->GetMeterWindow();
ConfigParser& parser = meterWindow->GetParser();
std::wstring strTmp = LuaManager::ToWide(L, 2);
std::wstring strTmp = LuaManager::ToWide(2);
strTmp = parser.ReadString(self->GetName(), strTmp.c_str(), L"");
LuaManager::PushWide(L, strTmp);
LuaManager::PushWide(strTmp);
return 1;
}
@ -140,7 +140,7 @@ static int SetText(lua_State* L)
if (self->GetTypeID() == TypeID<MeterString>())
{
MeterString* string = (MeterString*)self;
std::wstring str = LuaManager::ToWide(L, 2);
std::wstring str = LuaManager::ToWide(2);
string->SetText(str.c_str());
}