<commit_before>#include "environ_utils.hpp"

#include <configure/lua/State.hpp>
#include <configure/Environ.hpp>
#include <configure/Node.hpp>

#include <boost/filesystem/path.hpp>

namespace fs = boost::filesystem;

namespace configure { namespace lua {

	template<>
	struct Converter<std::vector<Environ::Value>>
	{
		typedef std::vector<Environ::Value> extract_type;
		static extract_type extract(lua_State* state, int index)
		{
			extract_type res;
			int len = lua_rawlen(state, index);
			if (len <= 0)
				return res;
			res.reserve(len);
			for (int i = 1; i <= len; ++i)
			{
				lua_rawgeti(state, index, i);
				res.push_back(lua::Converter<Environ::Value>::extract(state, -1));
				lua_pop(state, 1);
			}
			return res;
		}

		static void push(lua_State* state, extract_type const& value)
		{
			lua_createtable(state, value.size(), 0);
			for (size_t i = 0; i < value.size(); ++i)
			{
				Converter<Environ::Value>::push(state, value[i]);
				lua_rawseti(state, -2, i);
			}
		}
	};

	void
	Converter<Environ::Value>::push(lua_State* state, extract_type const& value)
	{
		switch (value.which())
		{
			case 0:
				Converter<std::string>::push(
					state,
					boost::get<std::string>(value)
				);
				break;
			case 1:
				Converter<boost::filesystem::path>::push(
					state,
					boost::get<boost::filesystem::path>(value)<commit_msg>Fix array index (lua starts at 1) in environ vector list values.<commit_after>#include "environ_utils.hpp"

#include <configure/lua/State.hpp>
#include <configure/Environ.hpp>
#include <configure/Node.hpp>

#include <boost/filesystem/path.hpp>

namespace fs = boost::filesystem;

namespace configure { namespace lua {

	template<>
	struct Converter<std::vector<Environ::Value>>
	{
		typedef std::vector<Environ::Value> extract_type;
		static extract_type extract(lua_State* state, int index)
		{
			extract_type res;
			int len = lua_rawlen(state, index);
			if (len <= 0)
				return res;
			res.reserve(len);
			for (int i = 1; i <= len; ++i)
			{
				lua_rawgeti(state, index, i);
				res.push_back(lua::Converter<Environ::Value>::extract(state, -1));
				lua_pop(state, 1);
			}
			return res;
		}

		static void push(lua_State* state, extract_type const& value)
		{
			lua_createtable(state, value.size(), 0);
			for (size_t i = 0; i < value.size(); ++i)
			{
				Converter<Environ::Value>::push(state, value[i]);
				lua_rawseti(state, -2, i + 1);
			}
		}
	};

	void
	Converter<Environ::Value>::push(lua_State* state, extract_type const& value)
	{
		switch (value.which())
		{
			case 0:
				Converter<std::string>::push(
					state,
					boost::get<std::string>(value)
				);
				break;
			case 1:
				Converter<boost::filesystem::path>::push(
					state,
					boost::get<boost::filesystem::path>(value)
{'fraction_non_alphanumeric': 0.15913200723327306, 'fraction_numerical': 0.007233273056057866, 'mean_word_length': 3.9658886894075405, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '507929', 'n_tokens_mistral': 1172, 'n_tokens_neox': 975, 'n_words': 207}