Inventory Question

I want to create some form of factory that allows me to create Item tables very easily. If anyone could help me with this, give me some knowledge about this, I would highly appreciate it.

I’m going for something like

Items = {
["playermodel1"] = {Name = "Model1", ClassName = "somemodelpath", Description = "This is model 1", Callback = function(ply) ply:SetModel("somemodelpath") end},

["weapon1"] = {Name = "Weapon1", ClassName = "someweaponclass", Description = "pew", Callback = function(ply) ply:Give("someweaponclass") end },


Another potential problem I may run into is storing the inventory, would I just write keys into a table, save it, then use those keys to reference items in the Item table?

[editline]2nd March 2017[/editline]

Also I’d like to apologize for being extremely bad at explaining things. I’m very tired, as always.

If you want to easily create item tables, just make a function to do so. I’m having a hard time understanding the rest of your post.

I’ve actually never done a function like this before, can you whip me up an example?

Using an item table for an inventory, how would I go about saving the inventory, and reading it?

Something like this.
[lua]local function CreateItem(name, className, description, callback)
return {Name = name, ClassName = className, Description = description, Callback = callback}

local newItem = CreateItem(“Model1”, “somemodelpath”, “This is model 1”, function(ply) ply:SetModel(“somemodelpath”) end)

A lot of what goes into an inventory system is just in the way it’s designed. I don’t know how you are designing it, so I can’t say how you would go about saving it and loading it.