From 407f65aa8af6726c45c8212152388ab3cf834a71 Mon Sep 17 00:00:00 2001 From: copperwater Date: Sun, 1 Mar 2020 15:20:16 -0500 Subject: [PATCH] Print out Lua error message when encountering an error 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nhlua.c b/src/nhlua.c index b0addae53..098d74324 100644 --- a/src/nhlua.c +++ b/src/nhlua.c @@ -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 {