table expected, got sadface

I’m stumped.
I’ve been trying to incorporate Aarons online streaming radio derma into a usable Entity.
I get this Error when used:


 includes/extensions/table.lua:165: bad argument #1 to 'pairs' (table expected, got nil)

The Radio’s Files:
cl_init.lua:
[lua]
include(“shared.lua”)

function ENT:Draw()
self:DrawEntityOutline(0.0)
self:DrawModel()
end

local firstruncheck = 0
local pan

function radio()
if firstruncheck == 0 then
panel = vgui.Create( “DFrame” )
panel:SetPos( 100, 60)
panel:SetSize(800, 600)
panel:SetTitle( “Radio” )
panel:SetVisible( true )
panel:SetDraggable( true )
panel:ShowCloseButton( false )
panel:SetSizable(true)
panel:MakePopup()
pan = panel
local w = panel:GetWide()
local h = panel:GetTall()
local closebutton = vgui.Create( “DImageButton”, panel )
closebutton:SetPos( 780, 5 )
closebutton:SetImage( “silkicons/exclamation.vtf” )
closebutton:SizeToContents()
closebutton.DoClick = function()
mouseExitPosX, mouseExitPosY = gui.MousePos()
radiopage:StopAnimate()
if panel:IsVisible() then
panel:SetVisible(false)
end
gui.EnableScreenClicker(false)
end
local PropertySheet = vgui.Create( “DPropertySheet” )
PropertySheet:SetParent( panel )
PropertySheet:SetPos( 5, 30 )
PropertySheet:SetSize( w-10, h-35 )
--------------------------Begin Radio Tab----------------------------------
radiourl = [[<html>
<body><font size=“1” face=“Verdana”><center>
<b>Welcome</b><br>
This Is Aarons GarrysMod Radio<br>
You can load your custom url’s by pressing the “load custom url” button below <br>
Make sure you dont put the http:// or www. tho or else it wont work<br>
Or you can load one of our fine selection of stations above :smiley: <br>
<font size=“1” face=“Verdana”></center>
</body>
</html>
]]
radiolastsaidsong = 0
timer.Create(“saysongtimer”, 1, 0, function()
radiolastsaidsong = radiolastsaidsong - 1
if
radiolastsaidsong < 0
then radiolastsaidsong = 0
end
end )
local RADIO = vgui.Create( “DPanel”, PropertySheet )
RADIO:SetSize( w-20, h-45 )
RADIO.Paint = function()
surface.SetDrawColor( 0, 0, 0, 0 )
surface.DrawRect( 0, 0, RADIO:GetWide(), RADIO:GetTall() )
end
radiolist = vgui.Create(“DListView”)
radiolist:SetParent(RADIO)
radiolist:SetPos(1, 1)
radiolist:SetSize(775, 430)
radiolist:SetMultiSelect(false)
radiolist:SetSortable(true)
local lstRadioTitle = radiolist:AddColumn(“Title”)
local lstRadioURL = radiolist:AddColumn(“URL”)
local lstRadioGenre = radiolist:AddColumn(“Genre”)
local lstRadioType = radiolist:AddColumn(“Type”)
radiolist:SortByColumn( 1 )
lstRadioTitle:SetWide( 100 )
lstRadioURL:SetWide( 300 )
lstRadioGenre:SetWide( 15 )
lstRadioType:SetWide( 1 )
radiopage = vgui.Create( “HTML” , RADIO);
radiopage:SetPos(0,445);
radiopage:SetSize(775,255);
radiopage:SetVisible(true);
radiopage:SetHTML( radiourl );
radiopage:Refresh(true);
radiopage:StartAnimate(100)
radiolist.OnRowSelected = function()
radioselect = DermaMenu()
radioselect:AddOption(“Load This For Me Please”, function()
panel:SetTitle( “Radio”…" - Currently Listining To: Title: "…radiosongTitle…
" URL: “…radiosongURL…” Genre: “…radiosongGenre )
radiourl = [[<center>
<OBJECT ID=“MediaPlayer” WIDTH=“750” HEIGHT=“44” CLASSID=“CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95”
STANDBY=“Loading Windows Media Player components…” TYPE=“application/x-oleobject”>
<PARAM NAME=“FileName” VALUE=“http://]]…radiosongURL…[[”>
<PARAM name=“autostart” VALUE=“true”>
<PARAM name=“ShowControls” VALUE=“true”>
<param name=“ShowStatusBar” value=“false”>
<PARAM name=“ShowDisplay” VALUE=“false”>
</OBJECT>
</center>]]
radiopage:SetHTML( radiourl );
myradiotype = “aaron”
print(”

Currently Selected Song:
Title: “…radiosongTitle…”
URL: “…radiosongURL…”
Genre: “…radiosongGenre…”
Type: “…radiosongType…”

“)
if radiolastsaidsong <= 0 then
radiolastsaidsong = 30
LocalPlayer():ConCommand(“say “/me Is Currently Listening To (Aarons Radio) “…radiosongTitle…”””)
else
LocalPlayer():ChatPrint(“Please Wait “…radiolastsaidsong…” Seconds Before Announcing Your Song”)
end
end )
radioselect:AddOption(“Load This For Me Please - Dont Announce Tho”, function()
panel:SetTitle( “Radio”…” - Currently Listining To: Title: "…radiosongTitle…
" URL: “…radiosongURL…” Genre: “…radiosongGenre )
radiourl = [[<center>
<OBJECT ID=“MediaPlayer” WIDTH=“750” HEIGHT=“44” CLASSID=“CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95”
STANDBY=“Loading Windows Media Player components…” TYPE=“application/x-oleobject”>
<PARAM NAME=“FileName” VALUE=“http://]]…radiosongURL…[[”>
<PARAM name=“autostart” VALUE=“true”>
<PARAM name=“ShowControls” VALUE=“true”>
<param name=“ShowStatusBar” value=“false”>
<PARAM name=“ShowDisplay” VALUE=“false”>
</OBJECT>
</center>]]
radiopage:SetHTML( radiourl );
myradiotype = “aaron”
print(”

Currently Selected Song:
Title: “…radiosongTitle…”
URL: “…radiosongURL…”
Genre: “…radiosongGenre…”
Type: “…radiosongType…”

“)
end )
radioselect:Open()
radiosongTitle = radiolist:GetLine(radiolist:GetSelectedLine()):GetValue(1)
radiosongURL = radiolist:GetLine(radiolist:GetSelectedLine()):GetValue(2)
radiosongGenre = radiolist:GetLine(radiolist:GetSelectedLine()):GetValue(3)
radiosongType = radiolist:GetLine(radiolist:GetSelectedLine()):GetValue(4)
end
radiostop = vgui.Create( “DButton”, RADIO )
radiostop:SetParent( RADIO )
radiostop:SetSize(RADIO:GetWide()-500, 15)
radiostop:SetPos( 490,432 )
radiostop:SetText( “Refresh The Radio” )
radiostop.DoClick = function( button )
reloadplylist()
reloadAaronsRadio()
firstruncheck = 1
end
radiostop = vgui.Create( “DButton”, RADIO )
radiostop:SetParent( RADIO )
radiostop:SetSize(RADIO:GetWide()-532, 15)
radiostop:SetPos( 248,432 )
radiostop:SetText( “Turn Off The Radio” )
radiostop.DoClick = function( button )
radiourl = [[<center>Radio Stopped</center>]]
radiopage:SetHTML( radiourl );
panel:SetTitle( “Radio” )
end
radioload = vgui.Create( “DButton”, RADIO )
radioload:SetParent( RADIO )
radioload:SetSize(RADIO:GetWide()-532, 15)
radioload:SetPos( 1,432 )
radioload:SetText( “Load Custom URL” )
radioload.DoClick = function( button )
local customradio = vgui.Create( “DFrame” )
customradio:SetPos( 250,250 )
customradio:SetSize( 500, 50 )
customradio:SetTitle( “URL Link: (dont put the http:// or www.)” )
customradio:ShowCloseButton( true )
customradio:SetVisible( true )
customradio:MakePopup()
local customradiotext = vgui.Create( “DTextEntry”, customradio )
customradiotext:SetPos( 20,27 )
customradiotext:SetTall( 20 )
customradiotext:SetWide( 450 )
customradiotext:SetEnterAllowed( true )
customradiotext.OnEnter = function()
customradiourl = customradiotext:GetValue()
radiourl = [[<center>
<OBJECT ID=“MediaPlayer” WIDTH=“750” HEIGHT=“44” CLASSID=“CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95”
STANDBY=“Loading Windows Media Player components…” TYPE=“application/x-oleobject”>
<PARAM NAME=“FileName” VALUE=“http://]]…customradiourl…[[”>
<PARAM name=“autostart” VALUE=“true”>
<PARAM name=“ShowControls” VALUE=“true”>
<param name=“ShowStatusBar” value=“false”>
<PARAM name=“ShowDisplay” VALUE=“false”>
</OBJECT>
</center>]]
radiopage:SetHTML( radiourl );
panel:SetTitle( “Radio”…” - Currently Listining To: "…customradiourl)
–print("Currently Selected Song: "…customradiourl)
customradio:SetVisible( false )
end
end
function reloadAaronsRadio()
radiolist:Clear()
//table.Empty(MusicList)
//table.Empty(TempT)
end
function FetchList ( SiteArgs, SiteSize )
if SiteSize <= 0 then
print("Site1 Failed To Load Size: “…SiteSize) --My ghetto attempt to load the list elsewhere if one site is down
if !htmlFail then
http.Get( “http://mcd2012.freesitespace.net/gmradio.html”, “”, FetchList )
htmlFail=1
elseif htmlFail==1 then
print(“Site2 Failed To Load”)
http.Get( “http://teacherweb.f-snet.com/gmradio.html”, “”, FetchList )
htmlFail=2
else
print(“Sites 1-3 Are Down, Radio Failed To Load”)
end
end
MusicList = {};
for _, Line in pairs(string.Explode(”
“, SiteArgs)) do
if string.len(Line) > 5 then
Info = string.Explode(” ", Line);
TempT = {};
TempT.Title = Info[1];
TempT.URL = Info[2];
TempT.Genre = Info[3];
TempT.Type = Info[4];
table.insert(MusicList, TempT)
end
end
for k, v in pairs(MusicList) do
radiolist:AddLine(v.Title,v.URL,v.Genre,v.Type)
end
end
http.Get(“http://aarons-gmodlua.googlecode.com/svn/trunk/gmradio/gmradio.html”, “”, FetchList);
---------------------End Radio Tab---------------------
PropertySheet:AddSheet( “Radio”, RADIO, “gui/silkicons/sound”, false, false, “Listen To Some Music” )
concommand.Add(“aaronsmenu_reloadaaron”, reloadAaronsRadio)
reloadplylist()
reloadAaronsRadio()
firstruncheck = 1
else
gui.SetMousePos(mouseExitPosX, mouseExitPosY)
panel:SetVisible(true)
radiopage:StartAnimate(100)
gui.EnableScreenClicker(true)
reloadplylist()
end
end
[/lua]
init.lua
[lua]
AddCSLuaFile(“cl_init.lua”)
AddCSLuaFile(“shared.lua”)
include(“shared.lua”)

function ENT:Initialize()
self:SetModel(“models/Squint/volksempfanger.mdl”)
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()

if phys and phys:IsValid() then phys:Wake() end

self:SetNWInt("damage",10)

self:SetNWString("Owner", "Shared")

end

function ENT:OnTakeDamage(dmg)
self:SetNWInt(“damage”, self:GetNWInt(“damage”) - dmg:GetDamage())

if self:GetNWInt("damage") &lt;= 0 then
    local effectdata = EffectData()
    effectdata:SetOrigin(self:GetPos())
    effectdata:SetMagnitude(2)
    effectdata:SetScale(2)
    effectdata:SetRadius(3)
    util.Effect("Sparks", effectdata)
    self:Remove()
end

end

function ENT:Pickup(ply)
self:Remove();
end

function ENT:UseItem(ply)
self:EmitSound(table.Random(VoiceListM))
ply:SendLua(“radio()”)
end
[/lua]
shared.lua
[lua]
ENT.Type = “anim”
ENT.Base = “base_gmodentity”
ENT.PrintName = “Radio”
ENT.Author = " Aaron"
ENT.Spawnable = true
ENT.AdminSpawnable = true

/---------------------------------------------------------
Name: Initialize
---------------------------------------------------------
/
function ENT:Initialize()
self:SetModel(“models/Squint/volksempfanger.mdl”)
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()

if phys and phys:IsValid() then phys:Wake() end

self:SetNWInt("damage",10)

self:SetNWString("Owner", "Shared")

end

function ENT:Use( ply, caller )
self:EmitSound(table.Random(VoiceListM))
ply:SendLua(“radio()”)
end
[/lua]
I have been unsuccessful in debugging it, so i am now calling out to anyone who can help!

You should add prints every so often to narrow down what line that error came from.

Your problem is probably line 213 in cl_init.lua:
[lua]for _, Line in pairs(string.Explode("
", SiteArgs)) do[/lua]
I don’t see SiteArgs defined anywhere.