lua: Print traceback on startup errors

We do some special magic so that we can have tracebacks on errors messages.
However, the code for parsing the rc.lua called it without this magic and thus
errors didn't have tracebacks.

This is bad, because if something goes wrong in e.g. wibox.widget.textbox, you
don't really have any clue where this error is coming from.

Fix this by adding our "print traceback on error"-magic here, too.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2013-06-08 13:21:14 +02:00
parent 14daf85fe9
commit 0c62831eea

5
luaa.c
View file

@ -666,7 +666,10 @@ luaA_loadrc(const char *confpath, bool run)
/* Set the conffile right now so it can be used inside the /* Set the conffile right now so it can be used inside the
* configuration file. */ * configuration file. */
conffile = a_strdup(confpath); conffile = a_strdup(confpath);
if(lua_pcall(globalconf.L, 0, LUA_MULTRET, 0)) /* Move error handling function before function */
lua_pushcfunction(globalconf.L, luaA_dofunction_on_error);
lua_insert(globalconf.L, -2);
if(lua_pcall(globalconf.L, 0, LUA_MULTRET, -2))
{ {
const char *err = lua_tostring(globalconf.L, -1); const char *err = lua_tostring(globalconf.L, -1);
luaA_startup_error(err); luaA_startup_error(err);