Esempio n. 1
1
//
// Printer
//
void Printer::PrintTable(std::string *result, Sqrat::Table table) {
	result->append("{");

	int i = 0;
	Sqrat::Table::iterator it;
	while (table.Next(it)) {
		if (i > 0) {
			result->append(",");
		}
		result->append("[\"");
		Sqrat::Object o(it.getKey(), table.GetVM());
		result->append(o.Cast<std::string>());
		result->append("\"]=");
		Sqrat::Object obj(it.getValue(), table.GetVM());
		PrintValue(result, obj);
		i++;
	}

	result->append("}");
}
Esempio n. 2
0
void JsonPrinter::PrintTable(Json::Value &value, Sqrat::Table table) {
	Sqrat::Table::iterator it;
	while(table.Next(it)) {
		Sqrat::Object o(it.getKey(), table.GetVM());
		std::string key = o.Cast<std::string>();
		Sqrat::Object obj(it.getValue(), table.GetVM());
		value[key] = PrintValue(obj);
	}
}