summaryrefslogtreecommitdiffstats
path: root/src/Bindings
diff options
context:
space:
mode:
Diffstat (limited to 'src/Bindings')
-rw-r--r--src/Bindings/LuaState.cpp2
-rw-r--r--src/Bindings/LuaState.h2
-rw-r--r--src/Bindings/ManualBindings.cpp4
-rw-r--r--src/Bindings/ManualBindings.h8
4 files changed, 10 insertions, 6 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index b7f5f17e0..c1612e6a1 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -2107,7 +2107,7 @@ void cLuaState::LogStackTrace(lua_State * a_LuaState, int a_StartingDepth)
-int cLuaState::ApiParamError(fmt::StringRef a_Msg)
+int cLuaState::ApiParamError(fmt::string_view a_Msg)
{
// Retrieve current function name
lua_Debug entry;
diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h
index bd75d8635..94b4ec16d 100644
--- a/src/Bindings/LuaState.h
+++ b/src/Bindings/LuaState.h
@@ -838,7 +838,7 @@ public:
/** Prints the message, 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(...)". */
- int ApiParamError(fmt::StringRef a_Msg);
+ int ApiParamError(fmt::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.
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index 5bf5062c9..9909b233a 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, fmt::ArgList a_ArgList)
+int cManualBindings::vlua_do_error(lua_State * L, const char * a_pFormat, fmt::printf_args a_ArgList)
{
// Retrieve current function name
lua_Debug entry;
@@ -129,7 +129,7 @@ int cManualBindings::lua_do_error(lua_State * L, const char * a_pFormat, fmt::Ar
// Copied from luaL_error and modified
luaL_where(L, 1);
- AString FmtMsg = Printf(msg.c_str(), a_ArgList);
+ AString FmtMsg = vPrintf(msg.c_str(), a_ArgList);
lua_pushlstring(L, FmtMsg.data(), FmtMsg.size());
lua_concat(L, 2);
return lua_error(L);
diff --git a/src/Bindings/ManualBindings.h b/src/Bindings/ManualBindings.h
index 173f62649..137956046 100644
--- a/src/Bindings/ManualBindings.h
+++ b/src/Bindings/ManualBindings.h
@@ -51,8 +51,12 @@ public:
// Helper functions:
static cPluginLua * GetLuaPlugin(lua_State * L);
static int tolua_do_error(lua_State * L, const char * a_pMsg, tolua_Error * a_pToLuaError);
- static int lua_do_error(lua_State * L, const char * a_pFormat, fmt::ArgList a_ArgList);
- FMT_VARIADIC(static int, lua_do_error, lua_State *, const char *)
+ static int vlua_do_error(lua_State * L, const char * a_pFormat, fmt::printf_args a_ArgList);
+ template <typename... Args>
+ static int lua_do_error(lua_State * L, const char * a_Format, const Args & ... args)
+ {
+ return vlua_do_error(L, a_Format, fmt::make_printf_args(args...));
+ }
/** Binds the DoWith(ItemName) functions of regular classes. */