Example #1
0
std::string lua_details::tableAsString(const TableInfo& table, size_t limit)
{
	std::ostringstream ost;

	ost << "{ ";

	const size_t count= table.size();

	for (size_t i= 0; i < count; ++i)
	{
		const LuaField& f= table[i];

		if (i > 0)
			ost << ", ";

		ost << f.getKey().getValue() << " = " << f.getValue().getValue();

		if (i + 1 == limit)
		{
			ost << ", ... ";
			break;
		}
	}

	if (count > 0)
		ost << ' ';

	ost << "}";

	return ost.str();
}