OOP: Using 'self'?

In Lua, the following are functionally equivalent:

Class.Function = function(self)
	print(self.Name)
end

function Class.Function(self)
	print(self.Name)
end

function Class:Function()
	print(self.Name)
end

With the colon, self is created as a variable implicitly and doesn’t require the declaration in the arguments. It is similar for calling where Workspace.GetChildren(Workspace) is functionally equivalent to Workspace:GetChildren(). For your example, you would want to move to something like this:

command = {
	Name = "test101";
	Aliases	= {};
	Prefixes = {settings.Prefix};
	Rank = 1;
	RankLock = false;
	Loopable = false;
	Tags = {};
	Description = "";
	Contributors = {};
	--
	Args = {};
	--
};

function command:Function()
	print(self.Name)
end

command:Function()
5 Likes