aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJude Melton-Houghton <jwmhjwmh@gmail.com>2021-10-05 08:38:33 -0400
committerGitHub <noreply@github.com>2021-10-05 15:38:33 +0300
commit5aa95fef102db02aa4b2f4a5c2b59ac985a54cef (patch)
tree90f6523dacc6a3cc4e74489e1df15bce57393a0f
parent4fca601e0cf74ce642e4e49ca7d4fe3e59915846 (diff)
downloadminetest-5aa95fef102db02aa4b2f4a5c2b59ac985a54cef.tar.gz
minetest-5aa95fef102db02aa4b2f4a5c2b59ac985a54cef.tar.bz2
minetest-5aa95fef102db02aa4b2f4a5c2b59ac985a54cef.zip
Make MetaDataRef:get return nil instead of nothing (#11666)
-rw-r--r--src/script/lua_api/l_metadata.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/script/lua_api/l_metadata.cpp b/src/script/lua_api/l_metadata.cpp
index 21002e6a7..d00cb4daa 100644
--- a/src/script/lua_api/l_metadata.cpp
+++ b/src/script/lua_api/l_metadata.cpp
@@ -82,9 +82,10 @@ int MetaDataRef::l_get(lua_State *L)
std::string str;
if (meta->getStringToRef(name, str)) {
lua_pushlstring(L, str.c_str(), str.size());
- return 1;
+ } else {
+ lua_pushnil(L);
}
- return 0;
+ return 1;
}
// get_string(self, name)