diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index f8dc318755357536a754701bcbf37e1ed0a26b36..4301762e2bfeb1576b2f6ce41168cd1248f80255 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -1917,6 +1917,7 @@ and `minetest.auth_reload` call the authetification handler.
 * `minetest.find_node_near(pos, radius, nodenames)`: returns pos or `nil`
     * `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"`
 * `minetest.find_nodes_in_area(minp, maxp, nodenames)`: returns a list of positions
+    * returns as second value a table with the count of the individual nodes found
     * `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"`
 * `minetest.find_nodes_in_area_under_air(minp, maxp, nodenames)`: returns a list of positions
     * returned positions are nodes with a node air above
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp
index 9581d1ef39f6286cda5a2c12ffe88f6662b9bf2d..50c445d5053cee8ac5d8ba4be27fe4d9fe625b3f 100644
--- a/src/script/lua_api/l_env.cpp
+++ b/src/script/lua_api/l_env.cpp
@@ -572,19 +572,28 @@ int ModApiEnvMod::l_find_nodes_in_area(lua_State *L)
 		ndef->getIds(lua_tostring(L, 3), filter);
 	}
 
+	std::map<content_t, u16> individual_count;
+
 	lua_newtable(L);
 	u64 i = 0;
-	for(s16 x = minp.X; x <= maxp.X; x++)
-	for(s16 y = minp.Y; y <= maxp.Y; y++)
-	for(s16 z = minp.Z; z <= maxp.Z; z++) {
-		v3s16 p(x, y, z);
-		content_t c = env->getMap().getNodeNoEx(p).getContent();
-		if(filter.count(c) != 0) {
-			push_v3s16(L, p);
-			lua_rawseti(L, -2, ++i);
-		}
+	for (s16 x = minp.X; x <= maxp.X; x++)
+		for (s16 y = minp.Y; y <= maxp.Y; y++)
+			for (s16 z = minp.Z; z <= maxp.Z; z++) {
+				v3s16 p(x, y, z);
+				content_t c = env->getMap().getNodeNoEx(p).getContent();
+				if (filter.count(c) != 0) {
+					push_v3s16(L, p);
+					lua_rawseti(L, -2, ++i);
+					individual_count[c]++;
+				}
 	}
-	return 1;
+	lua_newtable(L);
+	for (std::set<content_t>::iterator it = filter.begin();
+			it != filter.end(); ++it) {
+		lua_pushnumber(L, individual_count[*it]);
+		lua_setfield(L, -2, ndef->get(*it).name.c_str());
+	}
+	return 2;
 }
 
 // find_nodes_in_area_under_air(minp, maxp, nodenames) -> list of positions