Dot_access - hpgDesigns/hpgdesigns-dev.io GitHub Wiki
In EDL, dot access refers to expressions of the
form a.b
, and can be used in a number of ways.
Variables
Typically when dot-based access is brought up, it is referring to the
method inherited from GML, in which a
is an integer referencing an
instance ID or object index,
and b
is a local
variable. This expression will look up an object
with either an ID or Object index of a
, then access b
from
within its scope. This is useful for objects and
instances accessing a local variable of another object or instance,
either to read or change it.
Fields
EDL also inherits the dot operator from C++. It can therefore also be
used to access explicit fields in structures
and classes, whether the base a
is itself an
instance of that structure, or a pointer to such an instance.
Functions
Finally, functions can also be accessed in this
way, which is not a feature of GML or C++ (except as class members). The
most obvious example of this is class members, such as a.func()
where
a
is again an instance of a structure/class, and func
is a
member function of that class. Of course, this is only useful if said
structure/class already defined such a function.
The more interesting implication is instance-scoped functions, for
example, a.instance_destroy()
would function exactly the same as with (a) instance_destroy()
. Note that instance-scoped functions are not
implemented at this time, but are planned for the near future. In the
meantime, simply use with
as a workaround. Member functions and field
access, however, are implemented.