Rbxformat - string.format wrapper based on boost::format

explanation

i ported boost’s format library in the simplest fashion possible and now i’m releasing it here!

how does it work?

in boost’s format, you would do something like:

boost::format fmt("Here's %1% and there's %2% and then %.2f");
fmt % "this" % "that" % 120.0;

for simplicity, this module does not support placeholders like this. but maybe it will be added in the future.

in this module, the syntax works like this:

local fmt = format "Well here's %s and there's %s and then there's %.2f" % "this" % "that" % 120 

each time a % is done, it is passed in as an argument to string.format under the hood. in this example i didn’t use parentheses because imo it looks cleaner that way

how do i get it?

i’m not gonna sugarcoat it
rbxformat.rbxm (1.5 KB)

what now?

use it. report bugs. and please leave my credits in so other people can find this module

1 Like