File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -193,22 +193,28 @@ namespace DriverNG
193
193
}
194
194
195
195
// install our print function to the game
196
- sv[" print" ] = [](sol::variadic_args aArgs , sol::this_state aState)
196
+ sv[" print" ] = [](sol::variadic_args args , sol::this_state aState)
197
197
{
198
198
std::ostringstream oss;
199
199
sol::state_view s (aState);
200
+ auto toString = s[" tostring" ];
200
201
201
- for (auto it = aArgs.cbegin (); it != aArgs.cend (); ++it)
202
+ MsgInfo (" [Lua] " );
203
+
204
+ for (auto it = args.cbegin (); it != args.cend (); ++it)
202
205
{
203
- if (it != aArgs .cbegin ())
206
+ if (it != args .cbegin ())
204
207
{
205
208
oss << " " ;
209
+ MsgInfo (" " );
206
210
}
207
- std::string str = s[" tostring" ]((*it).get <sol::object>());
211
+
212
+ std::string str = ((*it).get_type () == sol::type::string) ? (*it).get <std::string>() : toString ((*it).get <sol::object>());
213
+
214
+ MsgInfo (str.c_str ());
208
215
oss << str;
209
216
}
210
-
211
- MsgInfo (" [Lua] %s\n " , oss.str ().c_str ());
217
+ MsgInfo (" \n " );
212
218
213
219
if (Globals::g_pDebugTools)
214
220
Globals::g_pDebugTools->LogGameToConsole (oss.str ());
You can’t perform that action at this time.
0 commit comments