Skip to content

Commit

Permalink
Add minetest.global_exists()
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowNinja authored and est31 committed Apr 21, 2015
1 parent 943c6e5 commit 436cb46
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions builtin/common/strict.lua
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion doc/lua_api.txt
Expand Up @@ -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
Expand Down Expand Up @@ -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}`)
Expand Down

0 comments on commit 436cb46

Please sign in to comment.