diff options
| author | Herman Semenov <GermanAizek@yandex.ru> | 2022-09-06 13:21:09 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-06 11:21:09 +0100 |
| commit | 038da00e799b4bf3af824075a260083c56392964 (patch) | |
| tree | 8c0e3218455073684c2521cec41b7df06fff8598 /src/script | |
| parent | ff6dcfea82974df6db5a557e31aaddb6bdb7a71f (diff) | |
| download | minetest-038da00e799b4bf3af824075a260083c56392964.tar.xz | |
Code optimizations / refactor (#12704)
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
Co-authored-by: sfan5 <sfan5@live.de>
Diffstat (limited to 'src/script')
| -rw-r--r-- | src/script/common/c_content.cpp | 2 | ||||
| -rw-r--r-- | src/script/cpp_api/s_base.cpp | 2 | ||||
| -rw-r--r-- | src/script/lua_api/l_client.cpp | 2 | ||||
| -rw-r--r-- | src/script/lua_api/l_item.cpp | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index fafb2edc9..f15d41f96 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -481,7 +481,7 @@ TileDef read_tiledef(lua_State *L, int index, u8 drawtype) else if(lua_istable(L, index)) { // name="default_lava.png" - tiledef.name = ""; + tiledef.name.clear(); getstringfield(L, index, "name", tiledef.name); getstringfield(L, index, "image", tiledef.name); // MaterialSpec compat. tiledef.backface_culling = getboolfield_default( diff --git a/src/script/cpp_api/s_base.cpp b/src/script/cpp_api/s_base.cpp index 595c9e540..659b32777 100644 --- a/src/script/cpp_api/s_base.cpp +++ b/src/script/cpp_api/s_base.cpp @@ -171,7 +171,7 @@ void ScriptApiBase::clientOpenLibs(lua_State *L) #endif }; - for (const std::pair<std::string, lua_CFunction> &lib : m_libs) { + for (const auto &lib : m_libs) { lua_pushcfunction(L, lib.second); lua_pushstring(L, lib.first.c_str()); lua_call(L, 1, 0); diff --git a/src/script/lua_api/l_client.cpp b/src/script/lua_api/l_client.cpp index 05ac53cbb..9f776ae28 100644 --- a/src/script/lua_api/l_client.cpp +++ b/src/script/lua_api/l_client.cpp @@ -237,7 +237,7 @@ int ModApiClient::l_get_language(lua_State *L) #endif std::string lang = gettext("LANG_CODE"); if (lang == "LANG_CODE") - lang = ""; + lang.clear(); lua_pushstring(L, locale); lua_pushstring(L, lang.c_str()); diff --git a/src/script/lua_api/l_item.cpp b/src/script/lua_api/l_item.cpp index 13d046d00..cf0fcce71 100644 --- a/src/script/lua_api/l_item.cpp +++ b/src/script/lua_api/l_item.cpp @@ -600,7 +600,7 @@ int ModApiItemMod::l_register_item_raw(lua_State *L) if(def.type == ITEM_NODE) def.node_placement_prediction = name; else - def.node_placement_prediction = ""; + def.node_placement_prediction.clear(); } // Register item definition |
