]> granicus.if.org Git - nethack/commitdiff
Print out Lua error message when encountering an error
authorcopperwater <aosdict@gmail.com>
Sun, 1 Mar 2020 20:20:16 +0000 (15:20 -0500)
committerPasi Kallinen <paxed@alt.org>
Mon, 6 Apr 2020 15:50:29 +0000 (18:50 +0300)
Rather than spitting out an error code number that is not particularly
useful. The string contains the line number and the nature of the error,
which is much more useful for debugging or reporting an issue.

src/nhlua.c

index b0addae53d60845a5adb34d869c2ced7d3967507..098d743249ee2b1cd039f6769fe1740fb787458d 100644 (file)
@@ -1094,8 +1094,8 @@ const char *fname;
 
     llret = luaL_loadbuffer(L, buf, strlen(buf), altfname);
     if (llret != LUA_OK) {
-        impossible("luaL_loadbuffer: Error loading %s (errcode %i)",
-                   altfname, llret);
+        impossible("luaL_loadbuffer: Error loading %s: %s",
+                   altfname, lua_tostring(L, -1));
         ret = FALSE;
         goto give_up;
     } else {