I noticed that I haven't gave you an useful examples.
@majqq
Well here you have an example of: B
In OOP.
Not MTA OOP, which I do not like, but pure Lua OOP. And see how the magic does it's job.
local newTable = enchantedTable:create()
newTable:add({type = "yes", 1, 2, 3, 4}, {type = "no", 5, 6, 7, 8}, {type = "no", 5, 6, 7, 8}) -- add three items
local collection = newTable:get() -- get the whole collection
print(collection[1]) -- get the first
print(collection[2]) -- get the second
print(collection[3]) -- get the third
-- Getting the result of the item records.
print("all: ", newTable:count()) -- count all: 3
print("`yes`: ", newTable:count("yes")) -- count only type `yes`: 1
print("`no`: ", newTable:count("no")) -- count only type `no`: 2
newTable:remove(2) -- remove item 2.
print("`no`: ", newTable:count("no")) -- count only type `no`: 1
When using this code you can easy extend functionality a long the way. Just adding methods to the methods-table and new functionality opens up to you.
But remember, do not modify the collection (of the items) without using these functions, or the registration will not be able to get track of the item count.