MQTT library PubSubClient - sending float/int/bool data to topics? char convert

Might've found the answer here:

http://2lemetry.com/2013/04/17/a-simple-example-arduino-mqtt-m2mio/

// publish light reading every 5 seconds
if (millis() > (time + 5000))
{
time = millis();
String pubString = "{"report":{"light": "" + String(lightRead) + ""}}";
pubString.toCharArray(message_buff, pubString.length()+1);
//Serial.println(pubString);
client.publish("io.m2m/arduino/lightsensor", message_buff);
}

In this example, rightRead is an int. The other parts of the message_buff are part of how this particular person is using the data, but the important part is this:

String(lightRead)

So this String() function converts whatever is sent to it as a parameters into a string.