aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2016-01-07 01:02:33 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2016-01-07 01:02:33 +0100
commitbf0e47f99f0ede6cbfb30c1f7aafdd2f1eca8683 (patch)
tree9ec5317048170e2fa2778e094eb7b9127d4d26f6
parentdf719c87e3a48903805c5f63c7e0cb5ed361104d (diff)
downloadapplause2-bf0e47f99f0ede6cbfb30c1f7aafdd2f1eca8683.tar.gz
improve error messages in case loading applause.lua fails
-rw-r--r--applause.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/applause.c b/applause.c
index f0e5034..99b5453 100644
--- a/applause.c
+++ b/applause.c
@@ -886,13 +886,17 @@ main(int argc, char **argv)
luaL_openlibs(L);
- if (luaL_loadfile(L, LUA_MODULE) || lua_pcall(L, 0, 0, 0)) {
- /* FIXME: pop error message */
- fprintf(stderr, "Error loading Lua module %s.\n",
- LUA_MODULE);
+ lua_pushcfunction(L, traceback);
+
+ if (luaL_loadfile(L, LUA_MODULE) || lua_pcall(L, 0, 0, -2)) {
+ fprintf(stderr, "Error loading Lua module %s: %s\n",
+ LUA_MODULE, lua_tostring(L, -1));
exit(EXIT_FAILURE);
}
+ /* remove traceback function */
+ lua_remove(L, -1);
+
init_audio(buffer_size);
/*