diff -r 9159bd51525f -r 81dbeb5bc38e src/lua_console.c --- a/src/lua_console.c Sun Apr 12 18:56:51 2009 +0300 +++ b/src/lua_console.c Sun Apr 12 20:37:57 2009 +0300 @@ -9,38 +9,18 @@ static void lua_console_on_line (const char *line, void *arg) { struct lua_console *lc = arg; - lua_State *L = lc->lua->st; - int ret; + struct error_info err; // ignore empty lines and EOF if (!line || !(*line)) return; - // XXX: move to nexus_lua - - // load the line as a lua function - if ((ret = luaL_loadstring(L, line))) - goto error; - - // execute it - if ((ret = lua_pcall(L, 0, 0, 0))) - goto error; - - // XXX: display results? - -error: - if (ret) { - struct error_info err; - - // build the error_info - nexus_lua_error(L, ret, &err); - - // log it + // eval it + if (nexus_lua_eval(lc->lua, line, &err)) log_error("%s", error_msg(&err)); - // pop it - lua_pop(L, -1); - } + // XXX: display return value? + } static struct console_callbacks _console_callbacks = {