Skip to content

Commit 128c66f

Browse files
committed
update(scripting/configuration): Add possibility to format text directly in Fetch
1 parent 261733c commit 128c66f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

plugin_files/scripting/includes/swiftly/configuration.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,19 @@ class Configuration
7272
Configuration() {}
7373

7474
template <typename T>
75-
T Fetch(const char *key)
75+
T Fetch(const char *key, ...)
7676
{
7777
void *configurationFetch = FetchFunctionPtr(nullptr, "scripting_Configuration_Fetch");
7878
if (configurationFetch)
7979
{
80-
const char *value = reinterpret_cast<Configuration_Fetch>(configurationFetch)(key);
80+
va_list ap;
81+
char buffer[2048];
82+
83+
va_start(ap, key);
84+
UTIL_FormatArgs(buffer, sizeof(buffer), key, ap);
85+
va_end(ap);
86+
87+
const char *value = reinterpret_cast<Configuration_Fetch>(configurationFetch)(buffer);
8188

8289
try
8390
{

0 commit comments

Comments
 (0)