Bad argument to pairs?

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

What the hell is that error supposed to mean?
this is my code but as it wont give me anything else but that, im not sure whats causing the problem.

[LUA]hook.Add(“OnNPCKilled”, “MoneyUp”, function(npc,killer,wep)
if not( killer:IsPlayer() ) then return end;
local mon = killer:GetNWInt(“money”, 0)
killer:SetNWInt(“money”, mon+10)
end)

concommand.Add(“CheckMoney”, function§
if( p:GetNWInt(“money”, 0) == 0 ) then
p:PrintMessage(3, “You have no money, Nubcaek”);
else
p:PrintMessage(3, “Money: $”…p:GetNWInt(“money”, 0))
end
end)

concommand.Add(“buy_ar2”, function§
if( p:GetNWInt(“money”, 0) < 800 ) then
p:PrintMessage(3, “No weapon for you noobcaek”);
else
p:PrintMessage(3, “You have bought a Combine Rifle”)
p:PrintMessage(3, “You now have $”…p:GetNWInt(“money”, 0))
local mon = p:GetNWInt(“money”, 0)
p:SetNWInt(“money”, mon-800)
local weapon1 = ents.Create(“weapon_ar2”)
weapon1:SetPos(p:LocalToWorld(p:OBBCenter()))
weapon1:Spawn()
end
end)

concommand.Add(“buy_smg”, function§
if( p:GetNWInt(“money”, 0) < 450 ) then
p:PrintMessage(3, “No weapon for you noobcaek”);
else
p:PrintMessage(3, “You have bought a Submachine Gun”)
p:PrintMessage(3, “You now have $”…p:GetNWInt(“money”, 0))
local mon = p:GetNWInt(“money”, 0)
p:SetNWInt(“money”, mon-450)
local weapon2 = ents.Create(“weapon_smg2”)
weapon2:SetPos(p:LocalToWorld(p:OBBCenter()))
weapon2:spawn()
end
end)

weapon_to_spawn = table.Random(WeaponList)

hook.Add(“InitPostEntity”, “Zombie_weapon_spawns”, function()
WeaponSpawns = ents.FindByClass(“random_weapon_spawn”)
ZombieSpawns = ents.FindByClass(“info_zombie_spawn”)
end)

function Weaponspawn()

local wep_spawn = table.Random(WeaponSpawns)
local wep_spawn_pos = wep_spawn:GetPos()
local wep_spawn_angles = wep_spawn:GetAngles()

local weapon_spawn = ents.Create(weapon_to_spawn)

weapon_spawn:SetPos(wep_spawn_pos)
weapon_spawn:SetAngles(wep_spawn_angles)
weapon_spawn:Spawn()

end

function SpawnZombie()
local spawn = table.Random(ZombieSpawns)
local pos = spawn:GetPos()
local angles = spawn:GetAngles()

local zombie = ents.Create("npc_zombie")
zombie:SetPos(pos)
zombie:SetAngles(angles)
zombie:Spawn()

end

WeaponList = {
“weapon_pistol”,
“weapon_smg1”,
“weapon_ar2”
}

timer.Create( “weapon_spawn_ilold”, 10, 0, Weaponspawn )

timer.Create(“zombieh_spawn”, 1, 0, SpawnZombie) [/LUA]

Is this all of your code?

Well it has nothing to do with the code you posted because you didn’t use “pairs” in that code at all.

Have you defined ZombieSpawns and WeaponSpawns?

[editline]06:51PM[/editline]

table.Random uses pairs AFAIK.

[editline]06:52PM[/editline]

http://luabin.foszor.com/code/lua/includes/extensions/table.lua#171