@Justmat Oh yeah, string.format is much simpler after all. I guess it was still a good exercise.
string.format