Skip to content

Commit 436cb46

Browse files
ShadowNinjaest31
authored andcommittedApr 21, 2015
Add minetest.global_exists()
1 parent 943c6e5 commit 436cb46

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed
 

Diff for: ‎builtin/common/strict.lua

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
local WARN_INIT = false
55

66

7+
function core.global_exists(name)
8+
return rawget(_G, name) ~= nil
9+
end
10+
11+
712
local function warn(message)
813
print(os.date("%H:%M:%S: WARNING: ")..message)
914
end

Diff for: ‎doc/lua_api.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -2289,6 +2289,9 @@ These functions return the leftover itemstack.
22892289

22902290
Please note that forceloaded areas are saved when the server restarts.
22912291

2292+
minetest.global_exists(name)
2293+
^ Checks if a global variable has been set, without triggering a warning.
2294+
22922295
### Global objects
22932296
* `minetest.env`: `EnvRef` of the server environment and world.
22942297
* 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`
24792482
{x=189, y=198}, -- < dig animation key frames
24802483
{x=200, y=219}, -- < walk+dig animation key frames
24812484
frame_speed=30): -- < animation frame speed
2482-
2485+
24832486
* `set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})`: defines offset value for camera per player
24842487
* in first person view
24852488
* in third person view (max. values `{x=-10/10,y=-10,15,z=-5/5}`)

0 commit comments

Comments
 (0)
Please sign in to comment.