weapons.Get and weapons.GetAll dont work?

Trying to retrive values from the SWEP tables, but they always return nil or tell me ‘attempt to index a nil value’ or “[@lua/includes/extensions/table.lua:195] bad argument #1 to ‘pairs’ (table expected, got nil)”

[lua]for k, v in pairs(ply:GetWeapons()) do
if weapons.Get( v ).ShouldHaveWeapon then
ply:Give(v)
end
end[/lua]

player.GetWeapons() returns a table containing the weapon entity of each weapon. You’re then calling **[Weapons.Get

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Weapons.Get)** with that entity, when according to the wiki it should be a string.

Try replacing weapons.Get( v ) with weapons.Get( v:GetClass() )

To be honest the code seems quite redundant… player.GetWeapons returns all the weapons that player has, and then you’re giving those entities again?