Stop propogating across instances, you damn Table!

I’m making a box SENT that you can store or take items from. The contents of the box is stored in a Table.

My problem is thus: Stuff you put in any box appears in all other boxes. Stuff you remove from a box is removed from all boxes.

What I want is for each box to have its own, individual contents.

Relevant abbreviated script from init.lua:
[lua]
ENT.Stored = {}

(support code, nothing to do with storing items)

function ENT:Think()
local Crate = self.Entity
if Crate.InUse == true then

	(stuff for selecting Item, nothing relevant)

	local Stored = Crate.Stored[Item]

	(checks for whether putting stuff in or taking it out, blah blah)

		Crate.Stored[Item] = Stored + Amount
		(or)
		Crate.Stored[Item] = Stored - Amount
	end
end

end
[/lua]

Any help would be greatly appreciated. If you need more information, or a better description, I’ll be happy to provide it.

Have you tried using self.Entity.Stored = {} ?

Not quite sure myself if ENT and self.Entity are the same like.

Trying that gave me:
entities/ammocrate_omni/init.lua:29: attempt to index global ‘self’ (a nil value)

What is this line 29? Where abouts are you declaring the variable?

Line 29 is what used to say “ENT.Stored = {}”. The above lines are all notes, todo lists, and so forth. I got that error when I replaced “ENT.Stored” with “self.Entity.Stored” as you suggested.

try this: place the declaration of the self.Entity.Stored = {} within the ENT.Initialize() hook.

It… works! Thank you for saving me from insanity.

I just wonder why the Table was doing this, and not the Booleans or Numbers? Oh well. With this, all I need to do is figure out how to hack a skin onto a model, and I’ll be ready to release. I’ll PM you when I do, so you can see what you helped create :smiley:

How do you mean “hack” a skin on? There’s a few functions like:

But then there’s also hexing a model as well, or trying to create a new skin completely?

I meant I was going to hex a skin onto a copied model (so as not to overwrite the original model) … But SetMaterial seems like a much better idea :smiley:

Thanks again.

Why the fuck are all posts getting 4 informatives right away?

Anyways, you’re welcome, even though I didn’t help