to_string
Convert any value to text. Analog of C++ std::to_string and Luau tostring.
Syntax
Section titled “Syntax”string to_string(value);Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
value | any | Value to convert. |
Return value
Section titled “Return value”string
Luau emit
Section titled “Luau emit”tostring(value)
Description
Section titled “Description”Use this when you need an explicit string — for example before storing in a StringValue, or when .: is not enough. Do not write Luau tostring in CL++ source.
Template strings already stringify interpolations: `coins {n}`.
Example
Section titled “Example”int coins = 50;string label = to_string(coins);post("held " .: label);Emits:
local coins: number = 50local label: string = tostring(coins)print("held " .. label)