How would I script my own Format Function?

You could string.split by {} and concatenate with the arguments you give it.

You could string.gsub to replace {} with %s and then use the built in formatter.

Or you could use string.gmatch to match everything between each set of {} and then again concatenate with the arguments you’ve given.

Whatever floats your boat.

Though it seems a pointless exercise to write your own formatting function. If it’s for problem solving and scripting practice it makes more sense to try to come up with the solution yourself, otherwise it’s just practice for everyone else on the forum and all you do is implement what we’ve told you.

3 Likes