mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
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:
@ -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);
|
||||
strTmp = parser.ReadString(self->GetName(), strTmp.c_str(), LuaManager::ToWide(L, 3).c_str());
|
||||
std::wstring strTmp = LuaManager::ToWide(2);
|
||||
strTmp = parser.ReadString(self->GetName(), strTmp.c_str(), LuaManager::ToWide(3).c_str());
|
||||
|
||||
LuaManager::PushWide(L, strTmp);
|
||||
LuaManager::PushWide(strTmp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ static int GetNumberOption(lua_State* L)
|
||||
MeterWindow* meterWindow = self->GetMeterWindow();
|
||||
ConfigParser& parser = meterWindow->GetParser();
|
||||
|
||||
std::wstring strTmp = LuaManager::ToWide(L, 2);
|
||||
std::wstring strTmp = LuaManager::ToWide(2);
|
||||
double value = parser.ReadFloat(self->GetName(), strTmp.c_str(), lua_tonumber(L, 3));
|
||||
|
||||
lua_pushnumber(L, value);
|
||||
@ -127,7 +127,7 @@ static int GetStringValue(lua_State* L)
|
||||
bool percentual = lua_toboolean(L, 5);
|
||||
|
||||
const WCHAR* val = self->GetStringOrFormattedValue(autoScale, scale, decimals, percentual);
|
||||
LuaManager::PushWide(L, val);
|
||||
LuaManager::PushWide(val);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user