diff options
author | Mattes D <github@xoft.cz> | 2023-05-11 22:05:17 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2023-05-16 23:50:37 +0200 |
commit | c9522fb740200ccef6230cec452c48efb31e5394 (patch) | |
tree | 7e74d70699e13dd0a92444a1a0add7a3059ac7ca /src/Bindings/LuaState.h | |
parent | Try a timeout for jobs. (diff) | |
download | cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.gz cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.bz2 cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.lz cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.xz cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.zst cuberite-c9522fb740200ccef6230cec452c48efb31e5394.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/LuaState.h | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h index d579369f0..64e6cbe82 100644 --- a/src/Bindings/LuaState.h +++ b/src/Bindings/LuaState.h @@ -68,7 +68,7 @@ public: if (a_ShouldLogStack) { // DEBUG: If an unbalanced stack is reported, uncommenting the next line can help debug the imbalance - // cLuaState::LogStackValues(a_LuaState, Printf("Started checking Lua stack balance, currently %d items:", m_StackPos).c_str()); + // cLuaState::LogStackValues(a_LuaState, fmt::format(FMT_STRING("Started checking Lua stack balance, currently {} items:"), m_StackPos).c_str()); // Since LogStackValues() itself uses the balance check, we must not call it recursively } } @@ -119,14 +119,14 @@ public: if (curTop > m_Count) { // There are some leftover elements, adjust the stack: - m_LuaState.LogStackValues(Printf("Re-balancing Lua stack, expected %d values, got %d:", m_Count, curTop).c_str()); + m_LuaState.LogStackValues(fmt::format(FMT_STRING("Re-balancing Lua stack, expected {} values, got {}:"), m_Count, curTop).c_str()); lua_pop(m_LuaState, curTop - m_Count); } else if (curTop < m_Count) { // This is an irrecoverable error, rather than letting the Lua engine crash undefinedly later on, abort now: LOGERROR("Unable to re-balance Lua stack, there are elements missing. Expected at least %d elements, got %d.", m_Count, curTop); - throw std::runtime_error(Printf("Unable to re-balance Lua stack, there are elements missing. Expected at least %d elements, got %d.", m_Count, curTop)); + throw std::runtime_error(fmt::format(FMT_STRING("Unable to re-balance Lua stack, there are elements missing. Expected at least {} elements, got {}."), m_Count, curTop)); } } @@ -838,25 +838,6 @@ public: Doesn't return, but a dummy return type is provided so that Lua API functions may do "return ApiParamError(...)". */ int ApiParamError(std::string_view a_Msg); - /** Formats and prints the message using printf-style format specifiers, but prefixed with the current function name, then logs the stack contents and raises a Lua error. - To be used for bindings when they detect bad parameters. - Doesn't return, but a dummy return type is provided so that Lua API functions may do "return ApiParamError(...)". */ - template <typename... Args> - int ApiParamError(const char * a_MsgFormat, const Args & ... a_Args) - { - return ApiParamError(Printf(a_MsgFormat, a_Args...)); - } - - /** Formats and prints the message using python-style format specifiers, but prefixed with the current function name, then logs the stack contents and raises a Lua error. - To be used for bindings when they detect bad parameters. - Doesn't return, but a dummy return type is provided so that Lua API functions may do "return ApiParamError(...)". */ - template <typename... Args> - int FApiParamError(const char * a_MsgFormat, const Args & ... a_Args) - { - return ApiParamError(fmt::format(a_MsgFormat, a_Args...)); - } - - /** Returns the type of the item on the specified position in the stack */ AString GetTypeText(int a_StackPos); |