string
Formats a string with placeholders using variable arguments.
Parameters:
str
(string): Format string with placeholders (%s, %d, %f, etc.)...
(any): Variable arguments to insert into placeholders
Returns:
result
(string): Formatted string
Example:
-- Basic string formatting
local message = ps.string("Hello %s, you have %d coins!", "John", 500)
-- Result: "Hello John, you have 500 coins!"
-- Format coordinates
local x, y, z = 100.5, 200.3, 30.1
local coords = ps.string("Position: %.1f, %.1f, %.1f", x, y, z)
-- Result: "Position: 100.5, 200.3, 30.1"
-- Format vehicle info
local model, plate = "adder", "ABC123"
local info = ps.string("Vehicle: %s (Plate: %s)", model, plate)
-- Result: "Vehicle: adder (Plate: ABC123)"
Last updated