added item.description() to itemlib, and update docs
This commit is contained in:
@@ -128,6 +128,14 @@ function inventory.decrement(invid, slot, count)
|
||||
end
|
||||
end
|
||||
|
||||
function inventory.get_caption(invid, slot)
|
||||
local item_id, count = inventory.get(invid, slot)
|
||||
local caption = inventory.get_data(invid, slot, "caption")
|
||||
if not caption then return item.caption(item_id) end
|
||||
|
||||
return caption
|
||||
end
|
||||
|
||||
function inventory.set_caption(invid, slot, caption)
|
||||
local itemid, itemcount = inventory.get(invid, slot)
|
||||
if itemid == 0 then
|
||||
@@ -139,6 +147,14 @@ function inventory.set_caption(invid, slot, caption)
|
||||
inventory.set_data(invid, slot, "caption", caption)
|
||||
end
|
||||
|
||||
function inventory.get_description(invid, slot)
|
||||
local item_id, count = inventory.get(invid, slot)
|
||||
local description = inventory.get_data(invid, slot, "description")
|
||||
if not description then return item.description(item_id) end
|
||||
|
||||
return description
|
||||
end
|
||||
|
||||
function inventory.set_description(invid, slot, description)
|
||||
local itemid, itemcount = inventory.get(invid, slot)
|
||||
if itemid == 0 then
|
||||
|
||||
Reference in New Issue
Block a user