aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_nodemeta.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/lua_api/l_nodemeta.cpp')
-rw-r--r--src/script/lua_api/l_nodemeta.cpp12
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");
}