summaryrefslogtreecommitdiff
path: root/builtin/common/strict.lua
diff options
context:
space:
mode:
authorHybridDog <ovvv@web.de>2016-06-28 06:34:22 +0200
committerest31 <est31@users.noreply.github.com>2016-06-28 06:34:22 +0200
commit80cebdc23c29ed778958ba3a35662cbc5f5e2f09 (patch)
treedcc29e32c574ad1ef015cb3ff3d4bef20442e840 /builtin/common/strict.lua
parentab7a5c4ff138c39a2491592731d677c9f392caa0 (diff)
downloadminetest-80cebdc23c29ed778958ba3a35662cbc5f5e2f09.tar.gz
minetest-80cebdc23c29ed778958ba3a35662cbc5f5e2f09.tar.bz2
minetest-80cebdc23c29ed778958ba3a35662cbc5f5e2f09.zip
Only allow strings to be passed to minetest.global_exists (#4253)
Sometimes you accidentally forget the quotes when using global_exists, this makes minetest abort if you did so. M builtin/common/strict.lua
Diffstat (limited to 'builtin/common/strict.lua')
-rw-r--r--builtin/common/strict.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/common/strict.lua b/builtin/common/strict.lua
index 05ceadf7a..23ba3d727 100644
--- a/builtin/common/strict.lua
+++ b/builtin/common/strict.lua
@@ -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