I really am not understanding string formats...so I was wondering...

Posted by Rivius on Sat 08 Jan 2011 03:46 AM — 3 posts, 14,591 views.

#0
ColourTell("silver", "", string.format("    %-15s %3d  %4d ", name, self.vials[name] or 0, self.sips[name] or 0))


Can someone help me break apart the string format so that I could colour the variables "name" and "self.sips[name]" differently?
Australia Forum Administrator #1
ColourTell takes groups of arguments, eg.


ColourTell ("silver", "", name,
            "gold", "", self.vials[name] or 0,
            "blue", "", self.sips[name] or 0)


You might need to add some spaces, but that is the general idea.
Amended on Sat 08 Jan 2011 03:57 AM by Nick Gammon
#2
EDIT: Ok. I think I have it