Where can I learn lua/swep creation, and mapping?

Ok, so I’ve never had any “proper” experience with lua (or any other coding language) and really want to learn how to make SWEP’s, the garrysmod.com wiki isn’t that good because they have 1 SWEP tutorial and it doesn’t even go into much detail. Are there any great tutorials that go into detail about what i have to learn for SWEP creation and such?

Also are there any good tutorials on mapping for Gmod, since most videos on YouTube for it are outdated.

But even once I read that, where do I go from there? How do I create a SWEP?

Use the outline of the tut on the wiki, it’s basically all the same. Hooks are implemented the same, just have different uses. Learn the different uses by looking at the page for it on the wiki

Will it teach me stuff like this: function SWEP:PrimaryAttack()

-- This weapon is 'automatic'. This function call below defines
-- the rate of fire. Here we set it to shoot every 0.5 seconds.
self.Weapon:SetNextPrimaryFire( CurTime() + 0.5 )

-- Call 'ThrowChair' on self with this model
self:ThrowChair( "models/props/cs_office/Chair_office.mdl" )

end


– Called when the rightmouse button is pressed

function SWEP:SecondaryAttack()

-- Note we don't call SetNextSecondaryFire here because it's not
-- automatic and so we let them fire as fast as they can click.

-- Call 'ThrowChair' on self with this model
self:ThrowChair( "models/props_c17/FurnitureChair001a.mdl" )

end


– A custom function we added. When you call this the player will fire a chair!

function SWEP:ThrowChair( model_file )

--
-- Play the shoot sound we precached earlier!
--
self:EmitSound( ShootSound )


--
-- If we're the client then this is as much as we want to do.
-- We play the sound above on the client due to prediction.
-- ( if we didn't they would feel a ping delay during multiplayer )
--
if ( CLIENT ) then return end

--
-- Create a prop_physics entity
--
local ent = ents.Create( "prop_physics" )

--
-- Always make sure that created entities are actually created!
--
if ( !IsValid( ent ) ) then return end

--
-- Set the entity's model to the passed in model
--
ent:SetModel( model_file )

--
-- Set the position to the player's eye position plus 16 units forward.
-- Set the angles to the player'e eye angles. Then spawn it.
--
ent:SetPos( self.Owner:EyePos() + ( self.Owner:GetAimVector() * 16 ) )
ent:SetAngles( self.Owner:EyeAngles() )
ent:Spawn()


--
-- Now get the physics object. Whenever we get a physics object
-- we need to test to make sure its valid before using it.
-- If it isn't then we'll remove the entity.
--
local phys = ent:GetPhysicsObject()
if ( !IsValid( phys ) ) then ent:Remove() return end


--
-- Now we apply the force - so the chair actually throws instead
-- of just falling to the ground. You can play with this value here
-- to adjust how fast we throw it.
--
local velocity = self.Owner:GetAimVector()
velocity = velocity * 100
velocity = velocity + ( VectorRand() * 10 ) -- a random element
phys:ApplyForceCenter( velocity )

--
-- Assuming we're playing in Sandbox mode we want to add this
-- entity to the cleanup and undo lists. This is done like so.
--
cleanup.Add( self.Owner, "props", ent )

undo.Create( "Thrown_Chair" )
	undo.AddEntity( ent )
	undo.SetPlayer( self.Owner )
undo.Finish()

end

?

It explains itself pretty clearly with comments.

but will there be more of that, since there are so many more of the ‘function’ and ‘local’ etc. will they be on the wiki? Because I don’t exactly know what to look for

My recommendation is that you read other people’s weapons to see what they’re doing since there’s so many cases. I would start with weapon_base since it lists every default function for SWEPs: https://github.com/garrynewman/garrysmod/tree/master/garrysmod/gamemodes/base/entities/weapons/weapon_base

locals and functions are explain in the link @Netheous posted. When you use them and where you don’t isn’t a strict thing, it comes with practice.

If you mean the stuff like



function SWEP:PrimaryAttack()
  -- etc, etc
end


If you read the link @Netheous posted you’d know that that’s just defining a function on the SWEP table, and considering that’s how hooks are defined, you can apply it to all sweps.

It’s good to have a gasp of the language before you look at game specific code like in garry’s mod. It allows you to know that stuff isn’t specific to other stuff, as well as gasp how the concept of it works.