reflect: Reflection operations
- GetMember(instance, id as Str) as dynamic
-
Return a member of an instance. The id argument must be a
Str object. Raise MemberError if the member is
not defined. Example:
var range = 2 to 5 GetMember(range, "start") -- 2
- SetMember(instance, id as Str, value)
- Set the value of a member of an instance. The id argument must be a Str object. Raise MemberError if the member is not defined or if it is a method or a constant.
- HasMember(instance, id as Str) as Boolean
- Return a boolean indicating whether an instance has a specific member. The id argument must be a Str object.
- TypeOf(instance) as Type
-
Return the type object corresponding to the class of the argument.
TypeOf works for all values except nil;
if the argument is nil, raise a ValueError exception.
The returned object is a type object bound to the relevant class
definition. Examples:
TypeOf(1) -- std::Int TypeOf([1, 2]) -- std::Array
See also: std::TypeName