forked from Mirrorlandia_minetest/minetest
Add minetest.global_exists()
This commit is contained in:
parent
943c6e523e
commit
436cb468e9
@ -4,6 +4,11 @@
|
|||||||
local WARN_INIT = false
|
local WARN_INIT = false
|
||||||
|
|
||||||
|
|
||||||
|
function core.global_exists(name)
|
||||||
|
return rawget(_G, name) ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local function warn(message)
|
local function warn(message)
|
||||||
print(os.date("%H:%M:%S: WARNING: ")..message)
|
print(os.date("%H:%M:%S: WARNING: ")..message)
|
||||||
end
|
end
|
||||||
|
@ -2289,6 +2289,9 @@ These functions return the leftover itemstack.
|
|||||||
|
|
||||||
Please note that forceloaded areas are saved when the server restarts.
|
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
|
### Global objects
|
||||||
* `minetest.env`: `EnvRef` of the server environment and world.
|
* `minetest.env`: `EnvRef` of the server environment and world.
|
||||||
* Any function in the minetest namespace can be called using the syntax
|
* Any function in the minetest namespace can be called using the syntax
|
||||||
|
Loading…
Reference in New Issue
Block a user