R2SW
- Parameters
-
r real
The number to be converted.
width integer
The width of the string. If the width of the resulting conversion is too small the string will be filled with spaces. Use 0 for no padding.
precision integer
The amount of decimal places. The minimum possible precision is 1 (automatically set).
- comment
Returns a string representation for real r with precision digits and width. The real is correctly rounded to nearest to fit within the precision.
Lua: Raises an error if r is null.
Works similar to C/C++ printf, but does not support negative width (left-align with right padding).
Example (Lua):
R2SW(31.1235, 5, 3) == "31.124" R2SW(1, 5, 0) == " 1.0" --> two spaces followed by number
- note
See:
R2S
for a simple converter with preset values.- pure
- This function is pure. For the same values passed to it, it will always return the same value.
- patch
1.00
- Source
- common.j
- return type
string
- Source code
native R2SW takes real r, integer width, integer precision returns string