1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Do version checking for Lua 5.2.

This commit is contained in:
batrick
2012-08-14 22:19:09 +00:00
parent a928251baf
commit 24e38466f5
2 changed files with 13 additions and 0 deletions

View File

@@ -759,6 +759,13 @@ void open_nse (void)
*/
srand(get_random_uint());
const lua_Number *version = lua_version(NULL);
double major = (*version) / 100.0;
double minor = fmod(*version, 10.0);
if (o.debugging >= 1)
log_write(LOG_STDOUT, "%s: Using Lua %.0f.%.0f.\n", SCRIPT_ENGINE, major, minor);
if (*version < 502)
fatal("%s: This version of NSE only works with Lua 5.2 or greater.", SCRIPT_ENGINE);
if ((L_NSE = luaL_newstate()) == NULL)
fatal("%s: failed to open a Lua state!", SCRIPT_ENGINE);
lua_atpanic(L_NSE, panic);