ESODecoded

GetNumBagFreeSlots

ESO Lua API function — used by 56 of the 3,030 addons we indexed (combined 11,401,971 downloads). Signature from the official ESOUIDocumentation.txt, API version 101050.

Official signature

GetNumBagFreeSlots([Bag|#Bag] bagId)

Returns: integer freeSlots

Real usage — from CraftStore

  if notpreview and control.data.craftable then
    if GetNumBagFreeSlots(BAG_BACKPACK) > 0 then
      local amount = isEnchanting and (tonumber(CraftStoreFixed_RuneAmount:GetText()) or 1) or (tonumber(CraftStoreFixed_CookAmount:GetText()) 

Short excerpt from the shipping addon CraftStoreits ESOUI page; the code belongs to its author. Shown because documentation without a working example is half a reference.

Most-downloaded addons using it

AddonTotal downloads
CraftStore5,176,147
Dustman1,178,205
AlphaGear 2 (Builds, Gear, Skills, Banking)848,683
Roomba - Guildbank Stacker675,040
Wykkyd Toolbar567,448
Wizard's Wardrobe481,038