From a8891ec0ca3d1b8e6d4f74e051b6e44fc5c4dc15 Mon Sep 17 00:00:00 2001 From: batrick Date: Thu, 16 Jul 2009 03:43:23 +0000 Subject: [PATCH] If the old _index metamethod does not exist then do not use it. This would cause "attempt to index a nil value" errors when whatever is being made "strict" did not have a metatable (the global environment for example). --- nselib/strict.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nselib/strict.lua b/nselib/strict.lua index bcb88f545..a5c4e2bd5 100644 --- a/nselib/strict.lua +++ b/nselib/strict.lua @@ -60,7 +60,7 @@ function strict () if type(_index) == "function" then local v = _index(t, n); -- hook it if v ~= nil then return v end - else + elseif _index ~= nil then local v = _index[n]; if v ~= nil then return v end end