Randomizing custom sounds for guns

My friend owns a server and is trying to make custom sounds for a gun that are randomized so its not the same sounds every time you fire the gun

He tried using tables but someone said that it won’t work if this is the entire table (http://puu.sh/4wYFX.txt)

Any ideas on how to do it?

fire1.wav fire2.wav fire3.wav

[lua]local DalapenoSounds = {
Sound( “lithium720/weapons/dalapeno_gun/1.wav” );
Sound( “lithium720/weapons/dalapeno_gun/2.wav” );
Sound( “lithium720/weapons/dalapeno_gun/3.wav” );
Sound( “lithium720/weapons/dalapeno_gun/4.wav” );
Sound( “lithium720/weapons/dalapeno_gun/5.wav” );
Sound( “lithium720/weapons/dalapeno_gun/6.wav” );
}

// When you go to play the self.Primary.Sound do

table.Random( DalapenoSounds );
[/lua]

table.Random will return a random element in a table.

Also these questions are probably more suited for :: http://facepunch.com/forumdisplay.php?f=65

Bump
I’d just like to state that the most efficient way to do this would probably be to use a sound script that has all the sound files listed. It will automatically choose them randomly.

apply the principles here to the method below:

[editline]29th September 2013[/editline]

so for an example:



sound.Add( 
{
 name = "Fire.Sound",
 channel = CHAN_WEAPON,
 volume = 1.0,
 soundlevel = 80,
 pitchstart = 95,
 pitchend = 110,
 sound = { "weapons/sound.wav" , "weapons/sound2.wav" , "weapons/sound3.wav" }
} )