mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Script: Improve 6560518
The Unicode state is not tracked using a stack instead of a raw boolean. This means that a Unicode script that e.g. updates a non-Unicode script measure will now work properly.
This commit is contained in:
@ -26,15 +26,25 @@ extern "C"
|
||||
#include "lauxlib.h"
|
||||
}
|
||||
|
||||
#include <vector>
|
||||
|
||||
class LuaManager
|
||||
{
|
||||
public:
|
||||
class ScopedLuaState
|
||||
{
|
||||
public:
|
||||
ScopedLuaState(bool unicode) { LuaManager::c_UnicodeStateStack.push_back(unicode); }
|
||||
~ScopedLuaState() { LuaManager::c_UnicodeStateStack.pop_back(); }
|
||||
operator lua_State*() { return LuaManager::c_State; }
|
||||
};
|
||||
|
||||
static void Initialize();
|
||||
static void Finalize();
|
||||
|
||||
static lua_State* GetState(bool unicode) { c_UnicodeState = unicode; return c_State; }
|
||||
static ScopedLuaState GetState(bool unicode) { return ScopedLuaState(unicode); }
|
||||
|
||||
static bool IsUnicodeState() { return c_UnicodeState; }
|
||||
static bool IsUnicodeState() { return c_UnicodeStateStack.back(); }
|
||||
|
||||
static void ReportErrors(const std::wstring& file);
|
||||
|
||||
@ -53,9 +63,10 @@ private:
|
||||
static void RegisterMeterWindow(lua_State* L);
|
||||
static void RegisterMeterString(lua_State* L);
|
||||
|
||||
// If set true |true|, Lua strings converted to/from as if they were encoded in UTF-8. Otherwise
|
||||
// Lua strings are treated as if they are encoded in the default system encoding.
|
||||
static bool c_UnicodeState;
|
||||
// If the back of the vector is |true|, Lua strings converted to/from as if they were encoded
|
||||
// in UTF-8. Otherwise Lua strings are treated as if they are encoded in the default system
|
||||
// encoding.
|
||||
static std::vector<bool> c_UnicodeStateStack;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user