summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anylike.org>2009-12-25 15:46:56 +0000
committerChristian Pointner <equinox@anylike.org>2009-12-25 15:46:56 +0000
commit7f637849f67c2b5f0fefb6a13c8aa72dd8f33df5 (patch)
tree6f7b476109a03d2784408ad89f2411953d3e5a1d
parentmoved from useless checklstring to checkstring (diff)
handling return value of main_loop
-rw-r--r--src/anylike.c10
-rw-r--r--src/main_loop.lua2
2 files changed, 8 insertions, 4 deletions
diff --git a/src/anylike.c b/src/anylike.c
index c6e39d7..d42dc4e 100644
--- a/src/anylike.c
+++ b/src/anylike.c
@@ -130,11 +130,15 @@ int main_loop(options_t* opt)
return -1;
}
-
-
+ int n = lua_gettop(L);
+ log_printf(DEBUG, "%s returned %d values", LUA_MAIN_LOOP, n);
+ int i;
+ for (i = 1; i <= n; i++)
+ log_printf(DEBUG, "return value [%d] = '%s'", i, luaL_checkstring(L, i));
+ ret = lua_tointeger(L, 1);
lua_close(L);
- return 0;
+ return ret;
}
int main(int argc, char* argv[])
diff --git a/src/main_loop.lua b/src/main_loop.lua
index 295caa5..b3a0c28 100644
--- a/src/main_loop.lua
+++ b/src/main_loop.lua
@@ -31,4 +31,4 @@ log.print("ERROR", "this is an error");
log.print("NOTICE", crypt.test());
-return "hello", "world";
+return 0, "hello", "world";