summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaState.cpp
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2018-01-03 18:41:16 +0100
committerGitHub <noreply@github.com>2018-01-03 18:41:16 +0100
commit757231cc6e777b8f4717d1467ef7efa01c7fde15 (patch)
tree6d1021761ad1c492700fe17560cb79520e508d60 /src/Bindings/LuaState.cpp
parentConcrete mixing (#4096) (diff)
downloadcuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.tar
cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.tar.gz
cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.tar.bz2
cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.tar.lz
cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.tar.xz
cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.tar.zst
cuberite-757231cc6e777b8f4717d1467ef7efa01c7fde15.zip
Diffstat (limited to 'src/Bindings/LuaState.cpp')
-rw-r--r--src/Bindings/LuaState.cpp21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index 095322bdd..f16b77dc8 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -2004,7 +2004,7 @@ void cLuaState::LogStackTrace(lua_State * a_LuaState, int a_StartingDepth)
-int cLuaState::ApiParamError(const char * a_MsgFormat, ...)
+int cLuaState::ApiParamError(const char * a_MsgFormat, fmt::ArgList argp)
{
// Retrieve current function name
lua_Debug entry;
@@ -2012,23 +2012,8 @@ int cLuaState::ApiParamError(const char * a_MsgFormat, ...)
VERIFY(lua_getinfo(m_LuaState, "n", &entry));
// Compose the error message:
- va_list argp;
- va_start(argp, a_MsgFormat);
- AString msg;
-
- #ifdef __clang__
- #pragma clang diagnostic push
- #pragma clang diagnostic ignored "-Wformat-nonliteral"
- #endif
-
- AppendVPrintf(msg, a_MsgFormat, argp);
-
- #ifdef __clang__
- #pragma clang diagnostic pop
- #endif
-
- va_end(argp);
- AString errorMsg = Printf("%s: %s", (entry.name != nullptr) ? entry.name : "<unknown function>", msg.c_str());
+ AString msg = Printf(a_MsgFormat, argp);
+ AString errorMsg = fmt::format("{0}: {1}", (entry.name != nullptr) ? entry.name : "<unknown function>", msg);
// Log everything into the console:
LOGWARNING("%s", errorMsg.c_str());