self.BaseClass - What does it do?

I know what ‘self’ is, just to let you know, but my question stays the same - what does self.BaseClass do?
I imagine it sets the script’s ‘class’ to the class after self.BaseClass. I’m not sure, so could you let me know in detail?

Hm, I wish I could supplement a definition to this, but it really just executes the original function you’re using. For example, how one might use self.BaseClass:<function>() in a gamemode:

[lua]
function GM:PlayerInitialSpawn(ply)
print(“This literally does nothing but print now.”);
end
[/lua]

This overwrites the original PlayerInitialSpawn() function in the base gamemode, meaning that none of this will run on our gamemode:
[lua]
function GM:PlayerInitialSpawn( pl )

pl:SetTeam( TEAM_UNASSIGNED )

if ( GAMEMODE.TeamBased ) then
    pl:ConCommand( "gm_showteam" )
end

end
[/lua]

Well, what if I wanted to use that original code and only add to it? self.BaseClass.
Now, I’m not too sure about the ordering part of this, I’m just assuming this works how I think it does because I’ve seen it vary:
[lua]
function GM:PlayerInitialSpawn(ply)
self.BaseClass:PlayerInitialSpawn()
print(“This literally does nothing but print now.”);
end
[/lua]
^ Will insert/execute the code of the original function and then my addendum.

[lua]
function GM:PlayerInitialSpawn(ply)
print(“This literally does nothing but print now.”);
self.BaseClass:PlayerInitialSpawn()
end
[/lua]
^ Will run my addendum and then insert/execute the code of the original function

I think I get it. Thank you.

It’s mainly for baddies that don’t know how what hooking is. But it does have uses: For instance, if you’re basing off of sandbox…

In PlayerInitialSpawn, you’ll need to run self.BaseClass.BaseClass:PlayerInitialSpawn() so that base’s spawn shit will run. Otherwise you’ll get infinite recursion as sandbox’s PlayerInitialSpawn calls itself.

FTFY.