bad arguement #1 to 'pairs' (table expected, got nil)
6 replies, posted
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:
[code]if table.HasValue(PHT_config.ChatCommands, strtext) then[/code]
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?
[QUOTE=NiandraLades;44274782]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?[/QUOTE]
Line 2
[code]
if (SERVER) then
AddCSLuaFile("pht_config.lua")
[/code]
I assume there would be some sort of config file, which you are missing?
Sorry, you need to Log In to post a reply to this thread.