Reflection module

set_value_from_string

procedure2 overloadsSource

Reads text into the value any points to: a bool (true or false), an integer, a float, a quoted string or an enum member name. Returns whether it worked; the value is left alone when it did not. The number must fit the type.

set_value_from_string :: (any: Any, text: string) -> bool

Parameters

any: Any
text: string

Returns

bool
Example↗
count: u8;
assert(set_value_from_string(count, "200"));
assert(count == 200);
assert(!set_value_from_string(count, "300"));
set_value_from_string :: (any: Any, text: *string) -> bool

Like the string form, and moves text past what it read so the next value can follow.

Parameters

any: Any
text: *string

Returns

bool

See also