diff options
author | DS <vorunbekannt75@web.de> | 2022-03-29 18:06:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-29 18:06:16 +0200 |
commit | 8d387433b14791db95e59127b5e6e30f58155c1e (patch) | |
tree | f7ce345cb892a6c9fdc0f210559e744c57e1f0d4 /src/script/lua_api/l_nodemeta.cpp | |
parent | 0f25fa7af655b98fa401176a523f269c843d1943 (diff) | |
download | minetest-8d387433b14791db95e59127b5e6e30f58155c1e.tar.gz minetest-8d387433b14791db95e59127b5e6e30f58155c1e.tar.bz2 minetest-8d387433b14791db95e59127b5e6e30f58155c1e.zip |
Fix the documentation of InvRef:get_lists() and clean up code (#12150)
Diffstat (limited to 'src/script/lua_api/l_nodemeta.cpp')
-rw-r--r-- | src/script/lua_api/l_nodemeta.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/script/lua_api/l_nodemeta.cpp b/src/script/lua_api/l_nodemeta.cpp index 34760157d..1d052685e 100644 --- a/src/script/lua_api/l_nodemeta.cpp +++ b/src/script/lua_api/l_nodemeta.cpp @@ -127,18 +127,14 @@ void NodeMetaRef::handleToTable(lua_State *L, Metadata *_meta) // fields MetaDataRef::handleToTable(L, _meta); - NodeMetadata *meta = (NodeMetadata*) _meta; + NodeMetadata *meta = (NodeMetadata *) _meta; // inventory - lua_newtable(L); Inventory *inv = meta->getInventory(); if (inv) { - std::vector<const InventoryList *> lists = inv->getLists(); - for(std::vector<const InventoryList *>::const_iterator - i = lists.begin(); i != lists.end(); ++i) { - push_inventory_list(L, inv, (*i)->getName().c_str()); - lua_setfield(L, -2, (*i)->getName().c_str()); - } + push_inventory_lists(L, *inv); + } else { + lua_newtable(L); } lua_setfield(L, -2, "inventory"); } |