Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:GetCraftingData

From RoR Wiki
Revision as of 19:43, 16 October 2026 by Maintenance script (talk | contribs) (UI Lua API import (WAR 1.4.8))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

UI Lua API · Crafting functions
Version: WAR 1.4.8

Returns the items currently placed in the crafting window of a trade skill.

craftingItems = GetCraftingData(tradeSkill)

Arguments

tradeSkill
number – A GameData.TradeSkills value. The stock UI uses APOTHECARY (4) and TALISMAN (5).

Returns

craftingItems
table – Array of 8 item data tables, indexed by crafting slot from 0 to 7.

Details

  • The indexes start at 0, not 1. ipairs skips entry 0; use a numeric for loop from 0 as the stock UI does.
  • All 8 entries are always present. A crafting slot without an item gets a table with default values (id 0).
  • Nothing is returned for trade skill 0 or 7. Other values are not range-checked, so only pass real trade skill values. Nothing is returned either if there is no player object or the Lua state is not available.
  • The stock crafting windows call it from their crafting status update handlers, together with GetCraftingBackPackSlots.
  • Exactly one argument must be passed.

Errors

None besides the generic Invalid Parameters message when the argument is missing or not a number.

Example

From default/ea_craftingwindow/source/talismanmakingwindow.lua:

function TalismanMakingWindow.UpdateCraftingStatus( updatedIngredients )
    ...
    local craftingData = GetCraftingData( GameData.TradeSkills.TALISMAN )
    local backpackSlots = GetCraftingBackPackSlots( GameData.TradeSkills.TALISMAN )
    ...
    for index = 0, TalismanMakingWindow.maxResources
    do
        if( not backpackSlots[index] )
        then
            break
        end
        local backpackSlot = backpackSlots[index].slot
        local backpackType = backpackSlots[index].backpack

        local currentItem = craftingData[index]
        local validItem = currentItem.id ~= 0

See also