Explorar o código

Fix unwanted newlines in Lua output.

The old NodeMCU puts() did not do the standard newline, while the RTOS C
library one certainly does.
Johny Mattsson %!s(int64=8) %!d(string=hai) anos
pai
achega
740c06b48f
Modificáronse 2 ficheiros con 4 adicións e 4 borrados
  1. 2 2
      app/lua/lua.c
  2. 2 2
      app/lua/luaconf.h

+ 2 - 2
app/lua/lua.c

@@ -533,7 +533,7 @@ static void dojob(lua_Load *load){
   load->done = 0;
   load->line_position = 0;
   memset(load->line, 0, load->len);
-  puts(load->prmt);
+  printf(load->prmt);
 }
 
 #ifndef uart_putc
@@ -599,7 +599,7 @@ static bool readline(lua_Load *load){
         if (load->line_position == 0)
         {
           /* Get a empty line, then go to get a new line */
-          puts(load->prmt);
+          printf(load->prmt);
         } else {
           load->done = 1;
           need_dojob = true;

+ 2 - 2
app/lua/luaconf.h

@@ -332,8 +332,8 @@ extern int readline4lua(const char *prompt, char *buffer, int length);
 ** avoids including 'stdio.h' everywhere.)
 */
 #if !defined(LUA_USE_STDIO)
-#define luai_writestring(s, l)  puts(s)
-#define luai_writeline()        puts("\n")
+#define luai_writestring(s, l)  printf(s)
+#define luai_writeline()        puts("")
 #endif // defined(LUA_USE_STDIO)
 
 /*