summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_item.cpp
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-08-19 22:23:47 +0200
committerGitHub <noreply@github.com>2017-08-19 22:23:47 +0200
commit88b436e6a9c98af7215bd115e1b7a3f1a1db99d3 (patch)
treef07cdd7f93ca26b84192d7b89f7b952e603ba5cf /src/script/lua_api/l_item.cpp
parent7528986e4449febead9b18b6118f0b096f7cf800 (diff)
downloadminetest-88b436e6a9c98af7215bd115e1b7a3f1a1db99d3.tar.gz
minetest-88b436e6a9c98af7215bd115e1b7a3f1a1db99d3.tar.bz2
minetest-88b436e6a9c98af7215bd115e1b7a3f1a1db99d3.zip
Code modernization: subfolders (#6283)
* Code modernization: subfolders Modernize various code on subfolders client, network, script, threading, unittests, util * empty function * default constructor/destructor * for range-based loops * use emplace_back instead of push_back * C++ STL header style * Make connection.cpp readable in a pointed place + typo
Diffstat (limited to 'src/script/lua_api/l_item.cpp')
-rw-r--r--src/script/lua_api/l_item.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/script/lua_api/l_item.cpp b/src/script/lua_api/l_item.cpp
index 0e4fc4ef0..207a04c6c 100644
--- a/src/script/lua_api/l_item.cpp
+++ b/src/script/lua_api/l_item.cpp
@@ -67,7 +67,7 @@ int LuaItemStack::l_set_name(lua_State *L)
bool status = true;
item.name = luaL_checkstring(L, 2);
- if (item.name == "" || item.empty()) {
+ if (item.name.empty() || item.empty()) {
item.clear();
status = false;
}
@@ -231,12 +231,11 @@ int LuaItemStack::l_to_table(lua_State *L)
lua_newtable(L);
const StringMap &fields = item.metadata.getStrings();
- for (StringMap::const_iterator it = fields.begin();
- it != fields.end(); ++it) {
- const std::string &name = it->first;
+ for (const auto &field : fields) {
+ const std::string &name = field.first;
if (name.empty())
continue;
- const std::string &value = it->second;
+ const std::string &value = field.second;
lua_pushlstring(L, name.c_str(), name.size());
lua_pushlstring(L, value.c_str(), value.size());
lua_settable(L, -3);
@@ -391,10 +390,6 @@ LuaItemStack::LuaItemStack(const ItemStack &item):
{
}
-LuaItemStack::~LuaItemStack()
-{
-}
-
const ItemStack& LuaItemStack::getItem() const
{
return m_stack;