aboutsummaryrefslogtreecommitdiff
path: root/gamemode/core/inventory/item.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2017-01-13 20:33:59 -0500
committerAlexander Pickering <alexandermpickering@gmail.com>2017-01-13 20:33:59 -0500
commitf4ee62bb0725a3ae94477b2818071f506e4dfd9f (patch)
tree5b185d1f93aea4e14a2d93e4addfde4dafda9bed /gamemode/core/inventory/item.lua
parent98e0462e4f6b13ff26af5211409352d45dd9453e (diff)
downloadartery-f4ee62bb0725a3ae94477b2818071f506e4dfd9f.tar.gz
artery-f4ee62bb0725a3ae94477b2818071f506e4dfd9f.tar.bz2
artery-f4ee62bb0725a3ae94477b2818071f506e4dfd9f.zip
Finished up shaped inventory, and more work on shared functions.
Diffstat (limited to 'gamemode/core/inventory/item.lua')
-rw-r--r--gamemode/core/inventory/item.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/gamemode/core/inventory/item.lua b/gamemode/core/inventory/item.lua
index 86bd105..354472a 100644
--- a/gamemode/core/inventory/item.lua
+++ b/gamemode/core/inventory/item.lua
@@ -32,11 +32,12 @@ function itm.RegisterItem(tbl)
assert(tbl[v] ~= nil, string.format("Attempted to register item without field %q",v))
end
assert(items[tbl.Name] == nil, string.format("Attempted to register 2 items with the same name %q",tbl.Name))
+ items[tbl.Name] = tbl
log.debug("Registered item: " .. tbl.Name .. "\n")
end
function itm.GetItemByName(name)
- assert(items[name] ~= nil,string.format("Attempted to get item with invalid name %q",name))
+ assert(items[name] ~= nil,string.format("Attempted to get item with invalid name %q Valid item names are:\n\t%s",name,table.concat(table.GetKeys(items),"\n\t")))
return items[name]
end
@@ -53,7 +54,7 @@ function itm.DeriveItem(tbl,name)
--Create a flywieght copy
local ret = tbl
local mt = {
- __index = function(tbl,key)
+ __index = function(ntbl,key)
return items[name][key]
end
}