ID:170177
Mar 11 2005, 5:35 pm
|
|
can someone explain to me the : and . path operators. I have been trying to understand them for around 30 minutes now but I still don't get it.
|
To put it simply, use "." when you want to access somethings information.
mob You only use ":" in more complex cases where the definition for the variable in question does not have the data, yet you know it is there. mob We know that O is of type /obj/test_type, but the compiler does not know that. Therefor, the compiler does not know it has the /proc/test_proc, and the ":" lets the compiler continue compiling even though it might seem like an error. The example there would be poor use in a real program, however. It would be simple enough to define the variable correctly, thus a use like that would be negligent and only give you headaches if you adopted such a programming habit. That operator is only useful in much more extreme cases. |
In response to Mega fart cannon
|
|
you two misunderstood me. I was am looking for the path operators. If you look in the DM guide you will notice that after the dereference section in the Proc chapter there is a section which talks about using . and : as shortcuts for paths and stuff of that manner. I belive . is called a look-up and : is called a look-down. Please explain to me . and : path operators are.
|
In response to Loduwijk
|
|
Your information is useful Loduwijk, but unfortunately doesn't have to do with his question. His question was about the : and . path operators. Shortcuts used when typing in a typepath.
|
In response to Blades
|
|
Blades wrote:
you two misunderstood me. I was am looking for the path operators. If you look in the DM guide you will notice that after the dereference section in the Proc chapter there is a section which talks about using . and : as shortcuts for paths and stuff of that manner. I belive . is called a look-up and : is called a look-down. Please explain to me . and : path operators are. The reference explains what they are, with examples. Take a look at it. |
: operator: This is the runtime search operator. It is used to access a property of a var that is not explicitly prototyped. If the variable doesn't have the specified variable, a run-time error occurs.