• Errors after saving a lua file (Tables with nil values)
    2 replies, posted
Hi, I've encountered a problem. When I start a server I'm not getting any errors (but the print function below prints "nil")but when I save a file I'm working on with the server running I'm spammed with [ERROR] attempt to index nil value. Here's the code: ignitionCheck = {} //just to make sure the table had a value I put it in multiple hooks function spawninit()     for k,v in pairs(player.GetAll()) do         ignitionCheck[v] = {Owner = v, Victim = v, Timerbool = false}     end end function fireinitspawn(ply)     ignitionCheck[ply] = {Owner = self, Victim = self, Timerbool = false} end function firepostthink(ply)     print(ignitionCheck[ply].Victim) //This lines gives the error: attempt to index a nil value end hook.Add("PlayerPostThink", "postthink", firepostthink) hook.Add("PlayerInitialSpawn", "initspawn", fireinitspawn) hook.Add( "Initialize", "spawninit", spawninit ) Any idea why?
if !ignitionCheck[ply] then return end
Whoopsie, missed that :P Anyway, it works now, thanks
Sorry, you need to Log In to post a reply to this thread.