aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_nodemeta.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/lua_api/l_nodemeta.cpp')
-rw-r--r--src/script/lua_api/l_nodemeta.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/script/lua_api/l_nodemeta.cpp b/src/script/lua_api/l_nodemeta.cpp
index d8de9a412..c8bc7d558 100644
--- a/src/script/lua_api/l_nodemeta.cpp
+++ b/src/script/lua_api/l_nodemeta.cpp
@@ -82,6 +82,8 @@ int NodeMetaRef::gc_object(lua_State *L) {
// get_string(self, name)
int NodeMetaRef::l_get_string(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
NodeMetaRef *ref = checkobject(L, 1);
std::string name = luaL_checkstring(L, 2);
@@ -98,6 +100,8 @@ int NodeMetaRef::l_get_string(lua_State *L)
// set_string(self, name, var)
int NodeMetaRef::l_set_string(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
NodeMetaRef *ref = checkobject(L, 1);
std::string name = luaL_checkstring(L, 2);
size_t len = 0;
@@ -115,6 +119,8 @@ int NodeMetaRef::l_set_string(lua_State *L)
// get_int(self, name)
int NodeMetaRef::l_get_int(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
NodeMetaRef *ref = checkobject(L, 1);
std::string name = lua_tostring(L, 2);
@@ -131,6 +137,8 @@ int NodeMetaRef::l_get_int(lua_State *L)
// set_int(self, name, var)
int NodeMetaRef::l_set_int(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
NodeMetaRef *ref = checkobject(L, 1);
std::string name = lua_tostring(L, 2);
int a = lua_tointeger(L, 3);
@@ -147,6 +155,8 @@ int NodeMetaRef::l_set_int(lua_State *L)
// get_float(self, name)
int NodeMetaRef::l_get_float(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
NodeMetaRef *ref = checkobject(L, 1);
std::string name = lua_tostring(L, 2);
@@ -163,6 +173,8 @@ int NodeMetaRef::l_get_float(lua_State *L)
// set_float(self, name, var)
int NodeMetaRef::l_set_float(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
NodeMetaRef *ref = checkobject(L, 1);
std::string name = lua_tostring(L, 2);
float a = lua_tonumber(L, 3);
@@ -179,6 +191,8 @@ int NodeMetaRef::l_set_float(lua_State *L)
// get_inventory(self)
int NodeMetaRef::l_get_inventory(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
NodeMetaRef *ref = checkobject(L, 1);
getmeta(ref, true); // try to ensure the metadata exists
InvRef::createNodeMeta(L, ref->m_p);
@@ -188,6 +202,8 @@ int NodeMetaRef::l_get_inventory(lua_State *L)
// to_table(self)
int NodeMetaRef::l_to_table(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
NodeMetaRef *ref = checkobject(L, 1);
NodeMetadata *meta = getmeta(ref, true);
@@ -230,6 +246,8 @@ int NodeMetaRef::l_to_table(lua_State *L)
// from_table(self, table)
int NodeMetaRef::l_from_table(lua_State *L)
{
+ MAP_LOCK_REQUIRED;
+
NodeMetaRef *ref = checkobject(L, 1);
int base = 2;