Skip to main content

luaur_common/functions/
format.rs

1//! Port of `Luau::format` from `Common/src/StringUtils.cpp`.
2//!
3//! See [`crate::functions::vformat_append`] for the documented deviation: the
4//! C++ variadic `std::string format(const char* fmt, ...)` becomes a
5//! `core::fmt::Arguments` consumer (callers pass `format_args!(...)`) so the
6//! port stays on stable + `wasm32`.
7
8use alloc::string::String;
9
10use crate::functions::vformat::vformat;
11
12#[allow(non_snake_case)]
13pub fn format(args: core::fmt::Arguments<'_>) -> String {
14    vformat(args)
15}