Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

The Colon Operator (“:”) is a shorthand syntax used for calling methods on objects.

When you use the colon syntax to call a function, the object (the “self”) is automatically passed as the first parameter to the function.

For example…

local Fruit = "Apple,Banana,Orange"
local List = string.split(Fruit, ",")
trace(List)

is equivalent to:

local Fruit = "Apple,Banana,Orange"
local List = Fruit:split(",")
trace(List)

  • No labels