diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2016-01-07 01:02:33 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2016-01-07 01:02:33 +0100 |
commit | bf0e47f99f0ede6cbfb30c1f7aafdd2f1eca8683 (patch) | |
tree | 9ec5317048170e2fa2778e094eb7b9127d4d26f6 | |
parent | df719c87e3a48903805c5f63c7e0cb5ed361104d (diff) | |
download | applause2-bf0e47f99f0ede6cbfb30c1f7aafdd2f1eca8683.tar.gz |
improve error messages in case loading applause.lua fails
-rw-r--r-- | applause.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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); /* |