string.ToColor
Example
Converting "255 0 255 125" to Color( 255, 0, 255, 125 )
Output: ["a"] = 125
["b"] = 255
["g"] = 0
["r"] = 255
Example: Failed Conversion
Demonstrates what happens when an invalid string is entered.
Output: ["a"] = 255
["b"] = 255
["g"] = 255
["r"] = 255
Example: Invalid String with Valid Substring
Demonstrates how a malformed input can produce an unexpected output.
Because the input string contains the valid substring 5 100 25, that will be treated as a "red green blue" formatted string to produce Color( 5, 100, 25 ).
All other text in the string, including the number 50, will be ignored.
Output: ["a"] = 255
["b"] = 25
["g"] = 100
["r"] = 5
Garry's Mod
Rust
Steamworks
Wiki Help