Added error message to output for NSE when a script could not be loaded.

See: http://seclists.org/nmap-dev/2008/q3/0265.html
This commit is contained in:
batrick 2008-08-07 12:32:39 +00:00
parent 213d3a4808
commit 984bdf65bb

View file

@ -85,7 +85,8 @@ static int loadfile (lua_State *L)
lua_setmetatable(L, -2);
if (luaL_loadfile(L, filename) != 0) // load the file (index 3)
luaL_error(L, "'%s' could not be loaded!", filename);
luaL_error(L, "'%s' could not be loaded:\n%s", filename,
lua_tostring(L, -1));
lua_pushvalue(L, -1);
lua_pushvalue(L, 2); // push environment table
lua_setfenv(L, -2); // set it