@@ -410,7 +410,12 @@ class IDeusConsoleManager {
410410 // TODO: FIX: Reading variable doesn't add its value to returnStr
411411 DeusConsoleVariable& variable = this ->getVariable (cmdTarget);
412412 commandResult.returnStr = variable.toString ();
413- return this ->getCVar <T>(cmdTarget);
413+ // For string return types, return the string representation instead of the raw value
414+ if constexpr (std::is_same_v<T, const char *> || std::is_same_v<T, char *>) {
415+ return commandResult.returnStr .c_str ();
416+ } else {
417+ return this ->getCVar <T>(cmdTarget);
418+ }
414419 } else if (commandResult.argc == 1 ) { // One token is write op
415420 // Get the variable for our intended target
416421 DeusConsoleVariable& variable = this ->getVariable (cmdTarget);
@@ -447,8 +452,16 @@ class IDeusConsoleManager {
447452 variable.onUpdate (variable.read ());
448453 }
449454
455+ // Update return string with the new value
456+ commandResult.returnStr = variable.toString ();
457+
450458 // Return new value
451- return static_cast <T>(this ->getCVar <T>(cmdTarget));
459+ // For string return types, return the string representation instead of the raw value
460+ if constexpr (std::is_same_v<T, const char *> || std::is_same_v<T, char *>) {
461+ return commandResult.returnStr .c_str ();
462+ } else {
463+ return static_cast <T>(this ->getCVar <T>(cmdTarget));
464+ }
452465 } else if (!methodExists) { // More than 1 token is a no-op on a variable
453466 throw DeusConsoleException (" Too many arguments" );
454467 }
0 commit comments