Indexed but not Indexed

The issue:

Ok so in this thread another coder helped me solve my table not creating when i had it create by checking if it was nil, now my new issue is the fact the init file does not even see the table.

Note:

Im new to lua in general so if you have pointers then if you will share the wisdom then ill be grateful, and dont link me the Wiki. its on my bookmarks bar so i can get to it if i need help with a pre-existing function

whats new since last post?

i rewrote the code to make it a addon instead of a module

i made a command call svitems to see if it was working on init and the error it gave me:

-Snip- Error fixed

sv_init.lua



print()
print()
print("###########################################")
print("###########################################")
print("###########################################")
print()
print("Inventory Initialized")
print()
print("###########################################")
print("###########################################")
print("###########################################")
print()
print()

include("autorun/NocturnalInventory/libraries/core/items.lua")
AddCSLuaFile("autorun/NocturnalInventory/libraries/core/items.lua")

include("autorun/NocturnalInventory/libraries/core/sh_shared.lua")
AddCSLuaFile("autorun/NocturnalInventory/libraries/core/sh_shared.lua")

local meta = FindMetaTable("Player")

function meta:SpawnItem( item )
	if(table.HasValue(Inventory.Items.Stored, item))then
		print("Spawning item: "..item)
	else
		print("No item registered as: "..item)
	end
end


concommand.Add("svitems",function(ply, cmd, args)
	if(table.HasValue(Inventory.CanSpawn,ply:SteamID())) then
		for item, _ in pairs( Inventory.Items.Stored ) do
            ply:PrintMessage(2, item)
        end
    else
    	ply:PrintMessage("You do have have the priveleges to access this command!")
	end
end)


items.lua



print()
print()
print("###########################################")
print("###########################################")
print("###########################################")
print()
print("Inventory Items Initialized")
print()
print("###########################################")
print("###########################################")
print("###########################################")
print()
print()

Inventory.Items = {}
Inventory.Items.Stored = {}

if(Inventory.Items == nil)then Inventory.Items = {} end
if(Inventory.Items.Stored == nil)then Inventory.Items.Stored = {} end

function Inventory.Items:Register(uid, table)

	if (not self.Stored[uid]) then self.Stored[uid] = {} end

	self.Stored[uid].Name = table.Name or ""
	self.Stored[uid].Info = table.Info or ""
	self.Stored[uid].Model = table.Model or ""
	self.Stored[uid].CanUse = table.CanUse or 1
	self.Stored[uid].CanDrop = table.CanDrop or 1
	self.Stored[uid].Weight = table.Weight or 1
	self.Stored[uid].Limit = table.Limit or 200
	self.Stored[uid].Dist = table.Dist or 1.2
	self.Stored[uid].ID = table.ID or 0

	if SERVER then
		print("[Inventory] - Registered item: "..table.Name.." ID: "..table.ID)
	end

end

function Inventory.Items:Get(item)
	if(table.HasValue(self.Stored, item)) then
		print("I have that item!")
		return self.Stored[item]
	end
end

local fol = "autorun/NocturnalInventory/libraries/core/items/"
local files, folders = file.Find(fol.."*","LUA")
print("[Inventory] Items: ",files,#files) 
print("[Inventory] Folders: ",folders,#folders)
print("[Inventory] Path: ",fol)
for k, v in pairs( files ) do

	include(fol .. v)
	print("FILE ",v)
	

	if (SERVER) then

		AddCSLuaFile(fol .. v)

	end

end

if(SERVER)then
	concommand.Add("item_use",function(ply, cmd, args)

		local item = args[1]

		if(table.HasValue(Inventory.Items.Stored, item)) then
			ply:ChatPrint("You used item "..item)
		end
	end)
end

concommand.Add("item_spawn", function(ply, cmd, args)
	if(game.SinglePlayer() or table.HasValue(Inventory.CanSpawn, ply:SteamID())) then
		if(args[1] != nil) then
			ply:SpawnItem(args[1])
		else
			print("item_spawn <item name>")
		end
	else
		print("You dont have access to this command!, if this is a mistake talk to the owner.")
	end
end)

concommand.Add("items",function(ply, cmd, args)
	if(table.HasValue(Inventory.CanSpawn,ply:SteamID())) then
		for item, _ in pairs( Inventory.Items.Stored ) do
            ply:PrintMessage(2, item)
        end
    else
    	ply:PrintMessage("You do have have the privileges to access this command!")
	end
end)