src/lua_console.c
branchlua-threads
changeset 205 c13d2fc7b480
parent 203 ffdf53fd0337
child 213 f0e52e026197
--- a/src/lua_console.c	Thu May 21 16:22:57 2009 +0300
+++ b/src/lua_console.c	Thu May 21 16:23:08 2009 +0300
@@ -20,7 +20,7 @@
 /**
  * Line finished execution
  */
-static void lua_console_on_thread (struct lua_thread *thread, const error_t *err, void *arg)
+static void lua_console_on_thread (const error_t *err, void *arg)
 {
     struct lua_console *lc = arg;
 
@@ -41,21 +41,26 @@
 {
     struct lua_console *lc = arg;
     error_t err;
+    int ret;
 
     // ignore empty lines and EOF
     if (!line || !(*line))
         return CONSOLE_CONTINUE;
     
     // exec it in our thread
-    if (lua_thread_start(&lc->thread, line, &err)) {
+    if ((ret = lua_thread_start(&lc->thread, line, &err)) < 0) {
         // display error message
         console_print(lc->console, error_msg(&err));
 
         return CONSOLE_CONTINUE;
-    } 
+    }
 
-    // wait for it to execute
-    return CONSOLE_WAIT;
+    // waiting?
+    if (ret)
+        return CONSOLE_WAIT;
+
+    else
+        return CONSOLE_CONTINUE;
 }
 
 static void lua_console_on_eof (void *arg)