Skip to main content

luaur_common/functions/
vformat.rs

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