Weird Indexing Problem

Charges is a table. It says attempting to index but has a nil, not really sure what that means. Is the table nil? Is the value I am addin nil?

My error and code.

Tell me if you need anything else.

plyarg.ctable is nil

Also, you’re attempting to get Murder from ctable and add 1 to it, but not checking if there is no Murder value in the table.


charges["Murder"] = (charges["Murder"] or 0) + 1

Please: http://forum.facepunch.com/showthread.php?t=1508566

P.s. No Originality? God of Scriptfodder criticism?

Well, apart from trying to do math on a nil value the error its giving now is that the players ctable doesnt exist.
So to create it the best way of doing it, right before


local charges = player.ctable

would be to put something like this:


player.ctable = player.ctable or {}

so if the table exists, the table keeps stored in the player, and if it doesnt exist it gets created.

Fuck doing that. The table is already set up. The reason it doesn’t work is because the player arguement it gets is the ground.

I’m just going to make a check so that it makes sure that it is a player.

Wait. The ground (i guess the world) gets in by an argument as the player does as well some times? What hook are you using for this? And if so, as you said i recommend you only doing your stuff in the hook if the entity argument is a player.

The check is when a player dies.

It just has what kills the player, I didn’t actually make a check to make sure it is a player. Silly me.

[editline]11th October 2016[/editline]

Privet comrade, te sznaesh miya outchen harasho.