summaryrefslogtreecommitdiffstats
path: root/src/Bindings/ManualBindings.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/ManualBindings.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/ManualBindings.cpp')
-rw-r--r--src/Bindings/ManualBindings.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index 7dd724d44..4e7d7c8ef 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -116,7 +116,7 @@ int cManualBindings::tolua_do_error(lua_State * L, const char * a_pMsg, tolua_Er
-int cManualBindings::lua_do_error(lua_State * L, const char * a_pFormat, ...)
+int cManualBindings::lua_do_error(lua_State * L, const char * a_pFormat, fmt::ArgList a_ArgList)
{
// Retrieve current function name
lua_Debug entry;
@@ -128,11 +128,9 @@ int cManualBindings::lua_do_error(lua_State * L, const char * a_pFormat, ...)
ReplaceString(msg, "#funcname#", (entry.name != nullptr) ? entry.name : "?");
// Copied from luaL_error and modified
- va_list argp;
- va_start(argp, a_pFormat);
luaL_where(L, 1);
- lua_pushvfstring(L, msg.c_str(), argp);
- va_end(argp);
+ AString FmtMsg = Printf(msg.c_str(), a_ArgList);
+ lua_pushlstring(L, FmtMsg.data(), FmtMsg.size());
lua_concat(L, 2);
return lua_error(L);
}