Only allow strings to be passed to minetest.global_exists (#4253)
authorHybridDog <ovvv@web.de>
Tue, 28 Jun 2016 04:34:22 +0000 (06:34 +0200)
committerest31 <est31@users.noreply.github.com>
Tue, 28 Jun 2016 04:34:22 +0000 (06:34 +0200)
Sometimes you accidentally forget the quotes when using global_exists, this makes minetest abort if you did so.

M  builtin/common/strict.lua

builtin/common/strict.lua

index 05ceadf7afe076f34e9af18f6b62515116551039..23ba3d727a7398a9c0ad0c2f3cfe54669484c889 100644 (file)
@@ -5,6 +5,9 @@ local WARN_INIT = false
 
 
 function core.global_exists(name)
+       if type(name) ~= "string" then
+               error("core.global_exists: " .. tostring(name) .. " is not a string")
+       end
        return rawget(_G, name) ~= nil
 end