bad arguement #1 to 'pairs' (table expected, got nil)

I have this taunt menu I’m trying to get to work but this happens when I have the function to be able to open the menu with F4.
The following error does not show though when it is set to just be a concommand.

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

  1. pairs - [C]:-1
  2. HasValue - lua/includes/extensions/table.lua:99
  3. fn - addons/prop hunt taunts/lua/autorun/sh_taunt.lua:16
  4. unknown - addons/ulib/lua/ulib/shared/hook.lua:183

Any idea what could cause this sort of error?

You supply a nil value to first argument of table.HasValue( t, val ) in your code, at sh_taunt.lua line 16.

Line 16 looks like this:


if table.HasValue(PHT_config.ChatCommands, strtext) then

PHT_config.ChatCommands is nil.

Well, “bad argument #1” means the first bit is causing issues, meaning there’s something wrong with ‘PHT_config.ChatCommands’.

Where is it used previously in the code?

Line 2



if (SERVER) then
	AddCSLuaFile("pht_config.lua")


I assume there would be some sort of config file, which you are missing?