All Entities have an index of 0?

So I am trying to get the shipment data. No luck so far.

Weird thing is all the shipments I spawn have an ENT Index of 0.
I save the table to a file so there isn’t a problem in actually reading the table.

I tried getting


Not sure what to do. The shipments I spawn are the ones I buy in the F4 menu.

Some screenshots of the code

Update* It seems the problem is that all my entities all have the Ent Index of 0. I don’t know why. Anyone have this problem before?

Update* Every entity does show the unique ID when I print out tostring(ent).
But there is no index whenever I do tostring(ent.EntIndex)

You’re doing this:


While you should be doing either of these:


Why? Isn’t ent already defined so EntIndex knows what the ent is? I didn’t realize EntIndex took parameters.

Edit* Question still stands, I see now you replaced . with : which I get the syntax error but why define ent as a paramaeter in the second example you gave me?

Not sure if I am right here but is it because ent:EntIndex() calls the action on the ent and ent.EntIndex is just the path for that action without actually calling it since there is no parameter?

Like table.subtable() wouldn’t work?

[editline]30th September 2016[/editline]

I guess I kinda answered my own question. Another question for DarkRp, I was trying to get the shipment table so the code can tell what shipment it was but for some reason I can’t find any code to be able to do that. I tried the keyvalues() the table(), savetable() pretty much a bunch of stuff on gmod wiki.

Do you have any ideas on how I could do it?