API:GetCraftingItemData
From RoR Wiki
UI Lua API · Crafting functions
Version: WAR 1.4.8
Returns the items in the player's crafting backpack, one table per slot.
items = GetCraftingItemData()
Arguments
None.
Returns
- items
table– Array of item data tables, indexed by crafting backpack slot from 1.
Details
- There is one entry for every crafting backpack slot the player has, including empty slots. An empty slot has an item table with default values (
id0, emptyname). - If there is no player object, or the Lua state is not available, the function returns nothing.
- A new table is built on every call. The stock UI caches it in
DataUtils.GetCraftingItems()(easystem_utils/source/datautils.lua).
Errors
None.
Example
From default/easystem_utils/source/datautils.lua:
function DataUtils.GetCraftingItems()
if (GameData.Player.craftingItemsDirty)
then
GameData.Player.itemsDirty = false
DataUtilsData.craftingItems = GetCraftingItemData()
end
return DataUtilsData.craftingItems
end
Note that this stock function clears itemsDirty instead of craftingItemsDirty, so it rebuilds the crafting list on every call while the crafting flag stays set.
