Hello! Simple question, is there a difference between the “.” and the “:” functions?
local list = {}
list.example = function() end;
function list:example() end;
Hello! Simple question, is there a difference between the “.” and the “:” functions?
local list = {}
list.example = function() end;
function list:example() end;
This should help:
https://www.lua.org/pil/16.html
The main difference is that with the colon you can use the self parameter in Object Oriented Programming.
Here’s a simple example:
local repStorage = game:GetService('ReplicatedStorage')
is the same as
local repStorage = game.GetService(game, 'ReplicatedStorage')