On this page
string.format
Returns a string where each {} in fmt is replaced by the next argument in order.
Syntax
Atlas Script
string.format(fmt, ...args)Parameters
fmt- Format string whose {} placeholders are filled by the following arguments in order.
...argsOptional- Additional values substituted in order for the remaining {} placeholders in the format string.
Return value
Returns string.
Remarks
Returns a string where each {} in fmt is replaced by the next argument in order. Extra {} with no argument become empty; extra arguments are ignored. Example: string.format("this {} is a test {}", 10, "cool") -> "this 10 is a test cool".
Examples
Inspect the controller family.atlas
event on_connect() {
system.log(string.format("Controller at Run: {}", system.controller));
}
event on_input() {
if (input.pressed("options")) {
if (input.controller == controller.ps5) {
system.log("PlayStation 5 controller");
} else if (input.controller == controller.xb) {
system.log("Xbox controller");
} else {
system.log(string.format("Controller family: {}", input.controller));
}
}
}