From 3b7f6112bbc607032223d926e9f47194a7cd03c9 Mon Sep 17 00:00:00 2001 From: AntumDeluge Date: Tue, 20 Jun 2017 20:57:41 -0700 Subject: [PATCH] [antum] Add function 'antum.getItem': Retrieves an item from registered items using name string. --- antum/api.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/antum/api.lua b/antum/api.lua index 9da3c19..08abcc1 100644 --- a/antum/api.lua +++ b/antum/api.lua @@ -174,6 +174,23 @@ function antum.dependsSatisfied(depends) end +--[[ + Retrieves an item from registered items using name string. + + @param item_name + Item name string to search for + @return + Item object with name matching 'item_name' parameter +]] +function antum.getItem(item_name) + for index in pairs(minetest.registered_items) do + if minetest.registered_items[index].name == item_name then + return minetest.registered_items[index] + end + end +end + + --[[ Retrieves a list of items containing a string.