string.format is the same kind of thing as printf (C, Java, etc) so it's a pretty common feature in a lot of langs.In the print string.format, what's the %d stuff about? I've tried to do things like that, and never gotten it to work the way I want, so I'm very curious.
%X is the format for a var, where X is the type. %d = integer, %f = float, %s = string, and so on. Those 3 are the biggest ones to know. The vars are passed in sequentially after the format. The lua docs reference this page for all formats, which most will work.
Things like %.2f mean 2 decimal places will always be printed e.g. string.format("%.2f", 1) = "1.00", string.format("%.2f", 1.23456) = "1.23", and so on.
There's lots of other formatting tricks you can use as well e.g. string.format("%10s", somestr) right justifies a string in a 10-wide block with spaces, so string.format("%10s", "hello") = " hello". (5 spaces before the hello; forum software squished it to 1..)
In short: it's just really good for strings with any kind of var in it. string.format("[%d %d %d]", x, y, z) is much easier to read than "[" .. x .. " " .. y .. " " .. z .. "]"