aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_metadata.cpp
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2018-02-18 10:40:45 +0100
committerSmallJoker <SmallJoker@users.noreply.github.com>2018-02-18 10:40:45 +0100
commit3f2e0c1206ed3d4dfe8a58048170a4ce3309b059 (patch)
tree953efbf6358fde65b5d350eb6475ae906c1943c5 /src/script/lua_api/l_metadata.cpp
parent46bbacee95b8cc68b7e531232a319ed46c2e1560 (diff)
downloadminetest-3f2e0c1206ed3d4dfe8a58048170a4ce3309b059.tar.gz
minetest-3f2e0c1206ed3d4dfe8a58048170a4ce3309b059.tar.bz2
minetest-3f2e0c1206ed3d4dfe8a58048170a4ce3309b059.zip
Check argument types inside MetaDataRef Lua API (#7045)
Diffstat (limited to 'src/script/lua_api/l_metadata.cpp')
-rw-r--r--src/script/lua_api/l_metadata.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/script/lua_api/l_metadata.cpp b/src/script/lua_api/l_metadata.cpp
index 494d2dce0..e84d1d939 100644
--- a/src/script/lua_api/l_metadata.cpp
+++ b/src/script/lua_api/l_metadata.cpp
@@ -95,7 +95,7 @@ int MetaDataRef::l_get_int(lua_State *L)
MAP_LOCK_REQUIRED;
MetaDataRef *ref = checkobject(L, 1);
- std::string name = lua_tostring(L, 2);
+ std::string name = luaL_checkstring(L, 2);
Metadata *meta = ref->getmeta(false);
if (meta == NULL) {
@@ -114,8 +114,8 @@ int MetaDataRef::l_set_int(lua_State *L)
MAP_LOCK_REQUIRED;
MetaDataRef *ref = checkobject(L, 1);
- std::string name = lua_tostring(L, 2);
- int a = lua_tointeger(L, 3);
+ std::string name = luaL_checkstring(L, 2);
+ int a = luaL_checkint(L, 3);
std::string str = itos(a);
Metadata *meta = ref->getmeta(true);
@@ -133,7 +133,7 @@ int MetaDataRef::l_get_float(lua_State *L)
MAP_LOCK_REQUIRED;
MetaDataRef *ref = checkobject(L, 1);
- std::string name = lua_tostring(L, 2);
+ std::string name = luaL_checkstring(L, 2);
Metadata *meta = ref->getmeta(false);
if (meta == NULL) {
@@ -152,8 +152,8 @@ int MetaDataRef::l_set_float(lua_State *L)
MAP_LOCK_REQUIRED;
MetaDataRef *ref = checkobject(L, 1);
- std::string name = lua_tostring(L, 2);
- float a = lua_tonumber(L, 3);
+ std::string name = luaL_checkstring(L, 2);
+ float a = luaL_checknumber(L, 3);
std::string str = ftos(a);
Metadata *meta = ref->getmeta(true);