Jass documentation Database

JASS Documentation Database REFORGED

Results for the query "R2SW" as a "function"

The search keyword must be a single word (no spaces).

Function R2SW

Line: 2229
Location: common.j
Constant? no
Type: native
Arguments: real r, integer width, integer precision
Returns: string


Extra spaces may have been removed from the original file to show the function in a comfortable way.
  1. native R2SW takes real r, integer width, integer precision returns string

Information about R2SW

Information contributed by City17
on February 27, 2022, 05:46:20 PM.
returns a string representation for real r with precision digits and width. The real is correctly rounded to nearest to fit within the precision. Raises an error if r is null.
The minimum possible precision is 1 (automatically set)

Works similar to C/C++ printf, but does not support negative width (left-align with right padding)
Example (Lua):
Code: [Select]
R2SW(31.1235, 5, 3) --> 31.124
R2SW(1, 5, 0) --> two spaces followed by number

See: R2S for a simple converter with preset values
Page loaded in 0.1191 seconds.
Vivir aprendiendo.co - A place for learning stuff, in Spanish   Chaos Realm - The world of Game modders and wc3 addicts   Diplo, a gaming community   Power of Corruption, an altered melee featuring Naga and Demon. Play it now!!!   WC3JASS.com - The JASS Vault + vJASS and Zinc   Jetcraft - A Starcraft II mod   WormTastic Clan (wTc)   Warcraft RESOURCES Reforged: Modelos, mapas, proyectos y mas...