Browse Source

tools-imgui: use console_send_repl()

Daniele Bartolini 6 năm trước cách đây
mục cha
commit
994b5a8a73
1 tập tin đã thay đổi với 13 bổ sung1 xóa
  1. 13 1
      tools-imgui/widgets/console.inl

+ 13 - 1
tools-imgui/widgets/console.inl

@@ -44,6 +44,18 @@ void console_send_script(TCPSocket& client, const char* lua)
 	console_send(client, string_stream::c_str(json));
 }
 
+void console_send_repl(TCPSocket& client, const char* lua)
+{
+	TempAllocator1024 ta;
+	StringStream json(ta);
+
+	json << "{\"type\":\"repl\",\"repl\":\"";
+	console_sanitize_json_string(json, lua);
+	json << "\"}";
+
+	console_send(client, string_stream::c_str(json));
+}
+
 void console_send_command(TCPSocket& client, char* cmd)
 {
 	TempAllocator1024 ta;
@@ -257,7 +269,7 @@ void console_execute_command(Console& console, TCPSocket& client, const char* co
 	}
 	else
 	{
-		console_send_script(client, command);
+		console_send_repl(client, command);
 	}
 
 	console._scroll_to_bottom = true;