aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-11-21 11:32:01 -0500
committerest31 <MTest31@outlook.com>2015-04-21 22:58:37 +0200
commit436cb468e9a832d15009d527d80c8dfe86bb2772 (patch)
tree1d0b163530902939b61902d393032a07482087ef
parent943c6e523e64dd879b7974b7adc35153095fd80e (diff)
downloadminetest-436cb468e9a832d15009d527d80c8dfe86bb2772.tar.gz
minetest-436cb468e9a832d15009d527d80c8dfe86bb2772.tar.bz2
minetest-436cb468e9a832d15009d527d80c8dfe86bb2772.zip
Add minetest.global_exists()
-rw-r--r--builtin/common/strict.lua5
-rw-r--r--doc/lua_api.txt5
2 files changed, 9 insertions, 1 deletions
diff --git a/builtin/common/strict.lua b/builtin/common/strict.lua
index c353bb913..c7b86461f 100644
--- a/builtin/common/strict.lua
+++ b/builtin/common/strict.lua
@@ -4,6 +4,11 @@
local WARN_INIT = false
+function core.global_exists(name)
+ return rawget(_G, name) ~= nil
+end
+
+
local function warn(message)
print(os.date("%H:%M:%S: WARNING: ")..message)
end
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index d9ab6a459..6325ed35d 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -2289,6 +2289,9 @@ These functions return the leftover itemstack.
Please note that forceloaded areas are saved when the server restarts.
+minetest.global_exists(name)
+^ Checks if a global variable has been set, without triggering a warning.
+
### Global objects
* `minetest.env`: `EnvRef` of the server environment and world.
* Any function in the minetest namespace can be called using the syntax
@@ -2479,7 +2482,7 @@ This is basically a reference to a C++ `ServerActiveObject`
{x=189, y=198}, -- < dig animation key frames
{x=200, y=219}, -- < walk+dig animation key frames
frame_speed=30): -- < animation frame speed
-
+
* `set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})`: defines offset value for camera per player
* in first person view
* in third person view (max. values `{x=-10/10,y=-10,15,z=-5/5}`)