ID:170177
 
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.
. operater: This is used to access the procs and vars of a prototyped object. The variable need not actually contain a value with the specified type, but must at least be a type with the specified variable or a run-time error will occur, causing the proc to crash.

: 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.
To put it simply, use "." when you want to access somethings information.
mob
var/speaches=0
verb/say(message as text)
world<<"[src.name]: [message]"
src.speaches+=1
src.post_say()
proc/post_say()
src<<"You have not spoken [src.speaches] times."

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
var/obj/test_type/tester
New()
tester=new
verb/test()
var/obj/O=tester
O:test_proc()
obj/test_type
proc/test_proc()
world<<"Tested"

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.