summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_internal.h
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-10-25 00:45:18 -0400
committerkwolekr <kwolekr@minetest.net>2015-10-25 23:06:48 -0400
commit54f1267c2c87daea769966c694777a2e5977f870 (patch)
treeae08897774c1b1d1ecae0ad1a31b147c9c98dd02 /src/script/lua_api/l_internal.h
parent3936a5e3f71d46e61f819b8f6c85dd47a440f21e (diff)
downloadminetest-54f1267c2c87daea769966c694777a2e5977f870.tar.gz
minetest-54f1267c2c87daea769966c694777a2e5977f870.tar.bz2
minetest-54f1267c2c87daea769966c694777a2e5977f870.zip
SAPI: Mark all Lua API functions requiring envlock
Diffstat (limited to 'src/script/lua_api/l_internal.h')
-rw-r--r--src/script/lua_api/l_internal.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/script/lua_api/l_internal.h b/src/script/lua_api/l_internal.h
index 1e40c5c4a..456c8fcce 100644
--- a/src/script/lua_api/l_internal.h
+++ b/src/script/lua_api/l_internal.h
@@ -33,6 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define API_FCT(name) registerFunction(L, #name, l_##name,top)
#define ASYNC_API_FCT(name) engine.registerFunction(#name, l_##name)
+#define MAP_LOCK_REQUIRED
#define NO_MAP_LOCK_REQUIRED
/*
@@ -45,4 +46,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#endif
*/
+#define GET_ENV_PTR_NO_MAP_LOCK \
+ ServerEnvironment *env = (ServerEnvironment *)getEnv(L); \
+ if (env == NULL) \
+ return 0
+
+#define GET_ENV_PTR \
+ MAP_LOCK_REQUIRED; \
+ GET_ENV_PTR_NO_MAP_LOCK
+
#endif /* L_INTERNAL_H_ */