#what does a Colon mean?

7 messages · Page 1 of 1 (latest)

wild pebble
#

. is used to reference an instance

#

: is for calling functions on an instance

languid kettle
#

: is used to invoke a function of an instance/object. It is syntax sugar that results in the following code:

x:y(...)
-- Becomes:
x.y(x, ...)
#

This is to facilitate the implicit self parameter when working with psuedo object-oriented programming, which Roblox bases the majority of its API off of

#

The real operator here is the dot operator (.). It's used to access members of an instance/object, and the keys of a table

#

A "funtion of an instance/object" is dubbed a "method"

#

Members are children of an instance, methods of an instance/object, and properties of an instance/object