ISteamInventoryο
Note
This documentation is auto-generated. Methods marked with π€ are automatically generated bindings. Methods marked with βοΈ are manually implemented and methods marked with β are currently not implemented.
Note
Overloaded Steam methods are exposed as distinct Lua functions using a type suffix (for example GetStatInt32 and SetStatFloat).
Note
This interface can be accessed has multiple accessors (e.g. a GameServer variant), the documentation shows Inventory everywhere but it can also be accessed with GameServerInventory.
List of Functionsο
List of Callbacksο
Function Referenceο
- Inventory.AddPromoItem(itemDef)ο
π€ Auto-generated binding
- Parameters:
itemDef (int - SteamItemDef_t) β
- Returns:
(bool) Return value
- Returns:
(int)
pResultHandle- SteamWorks:
Signature differences from C++ API:
Parameter
pResultHandleis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.
Example:
local ok, resultHandle = Steam.Inventory.AddPromoItem(promoItemDefID)
- Inventory.AddPromoItems(pArrayItemDefs, unArrayLength)ο
π€ Auto-generated binding
- Parameters:
pArrayItemDefs (int[]?) β
unArrayLength (int) β size of the input array
pArrayItemDefs
- Returns:
(bool) Return value
- Returns:
(int)
pResultHandle- SteamWorks:
Signature differences from C++ API:
Parameter
pResultHandleis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.
Example:
local ok, resultHandle = Steam.Inventory.AddPromoItems({item1, item2}, 2)
- Inventory.CheckResultSteamID(resultHandle, steamIDExpected)ο
π€ Auto-generated binding
- Parameters:
resultHandle (int - SteamInventoryResult_t) β
steamIDExpected (uint64 - CSteamID) β
- Returns:
(bool) Return value
- SteamWorks:
- Inventory.ConsumeItem(itemConsume, unQuantity)ο
π€ Auto-generated binding
- Parameters:
itemConsume (uint64 - SteamItemInstanceID_t) β
unQuantity (int) β
- Returns:
(bool) Return value
- Returns:
(int)
pResultHandle- SteamWorks:
Signature differences from C++ API:
Parameter
pResultHandleis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.
Example:
local ok, resultHandle = Steam.Inventory.ConsumeItem(itemInstanceID, 1)
-- Wait for OnSteamInventoryResultReady to confirm
- Inventory.DeserializeResult(pBuffer, unBufferSize, bRESERVED_MUST_BE_FALSE)ο
π€ Auto-generated binding
- Parameters:
pBuffer (str?) β
unBufferSize (int) β size of the input array
pBufferbRESERVED_MUST_BE_FALSE (bool) β
- Returns:
(bool) Return value
- Returns:
(int)
pOutResultHandle- SteamWorks:
Signature differences from C++ API:
Parameter
pOutResultHandleis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.
- Inventory.DestroyResult(resultHandle)ο
π€ Auto-generated binding
- Parameters:
resultHandle (int - SteamInventoryResult_t) β
- SteamWorks:
Notes:
See
Inventory.GetResultItems()βs example.
- Inventory.ExchangeItems(pArrayGenerate, punArrayGenerateQuantity, unArrayGenerateLength, pArrayDestroy, punArrayDestroyQuantity, unArrayDestroyLength)ο
π€ Auto-generated binding
- Parameters:
pArrayGenerate (int[]?) β
punArrayGenerateQuantity (int[]?) β
unArrayGenerateLength (int) β size of the input arrays
pArrayGenerateandpunArrayGenerateQuantitypArrayDestroy (uint64[]?) β
punArrayDestroyQuantity (int[]?) β
unArrayDestroyLength (int) β size of the input arrays
pArrayDestroyandpunArrayDestroyQuantity
- Returns:
(bool) Return value
- Returns:
(int)
pResultHandle- SteamWorks:
Signature differences from C++ API:
Parameter
pResultHandleis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.
- Inventory.GenerateItems(pArrayItemDefs, punArrayQuantity, unArrayLength)ο
π€ Auto-generated binding
- Parameters:
pArrayItemDefs (int[]?) β
punArrayQuantity (int[]?) β
unArrayLength (int) β size of the input arrays
pArrayItemDefsandpunArrayQuantity
- Returns:
(bool) Return value
- Returns:
(int)
pResultHandle- SteamWorks:
Signature differences from C++ API:
Parameter
pResultHandleis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.
- Inventory.GetAllItems()ο
π€ Auto-generated binding
- Returns:
(bool) Return value
- Returns:
(int)
pResultHandle- SteamWorks:
Signature differences from C++ API:
Parameter
pResultHandleis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.
Example:
-- Request all items the current user owns
local ok, resultHandle = Steam.Inventory.GetAllItems()
-- Wait for OnSteamInventoryResultReady callback
- Inventory.GetEligiblePromoItemDefinitionIDs(steamID, punItemDefIDsArraySize)ο
π€ Auto-generated binding
- Parameters:
steamID (uint64 - CSteamID) β
punItemDefIDsArraySize (int?) β size of the buffer to allocate for
pItemDefIDs. Ifnilthen the buffer will beNULL.
- Returns:
(bool) Return value
- Returns:
(int[])
pItemDefIDs- Returns:
(int)
punItemDefIDsArraySize- SteamWorks:
Signature differences from C++ API:
Parameter
pItemDefIDsis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.Parameter
punItemDefIDsArraySizeis both an input and an output in C++: you pass the buffer size, and Steam writes the actual count back. luasteam returns it as an additional return value.
- Inventory.GetItemDefinitionIDs(punItemDefIDsArraySize)ο
π€ Auto-generated binding
- Parameters:
punItemDefIDsArraySize (int?) β size of the buffer to allocate for
pItemDefIDs. Ifnilthen the buffer will beNULL.- Returns:
(bool) Return value
- Returns:
(int[])
pItemDefIDs- Returns:
(int)
punItemDefIDsArraySize- SteamWorks:
Signature differences from C++ API:
Parameter
pItemDefIDsis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.Parameter
punItemDefIDsArraySizeis both an input and an output in C++: you pass the buffer size, and Steam writes the actual count back. luasteam returns it as an additional return value.
Example:
local ids = Steam.Inventory.GetItemDefinitionIDs(256)
for _, defID in ipairs(ids) do
local ok, name = Steam.Inventory.GetItemDefinitionProperty(defID, 'name', 128)
print('Item def:', defID, name)
end
- Inventory.GetItemDefinitionProperty(iDefinition, pchPropertyName, punValueBufferSizeOut)ο
π€ Auto-generated binding
- Parameters:
iDefinition (int - SteamItemDef_t) β
pchPropertyName (str?) β
punValueBufferSizeOut (int?) β size of the buffer to allocate for
pchValueBuffer. Ifnilthen the buffer will beNULL.
- Returns:
(bool) Return value
- Returns:
(str)
pchValueBuffer- Returns:
(int)
punValueBufferSizeOut- SteamWorks:
Signature differences from C++ API:
Parameter
pchValueBufferis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.Parameter
punValueBufferSizeOutis both an input and an output in C++: you pass the buffer size, and Steam writes the actual count back. luasteam returns it as an additional return value.
Notes:
See
Inventory.GetItemDefinitionIDs()βs example.
- Inventory.GetItemPrice(iDefinition)ο
π€ Auto-generated binding
- Parameters:
iDefinition (int - SteamItemDef_t) β
- Returns:
(bool) Return value
- Returns:
(uint64)
pCurrentPrice- Returns:
(uint64)
pBasePrice- SteamWorks:
Signature differences from C++ API:
Parameter
pCurrentPriceis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.Parameter
pBasePriceis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.
- Inventory.GetItemsByID(pInstanceIDs, unCountInstanceIDs)ο
π€ Auto-generated binding
- Parameters:
pInstanceIDs (uint64[]?) β
unCountInstanceIDs (int) β size of the input array
pInstanceIDs
- Returns:
(bool) Return value
- Returns:
(int)
pResultHandle- SteamWorks:
Signature differences from C++ API:
Parameter
pResultHandleis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.
Example:
local ok, resultHandle = Steam.Inventory.GetItemsByID({itemInstanceID1, itemInstanceID2}, 2)
-- Wait for OnSteamInventoryResultReady
- Inventory.GetItemsWithPrices(unArrayLength)ο
π€ Auto-generated binding
- Parameters:
unArrayLength (int?) β size of the buffer to allocate for the output arrays
pArrayItemDefs,pCurrentPrices,pBasePrices. Ifnilthen the buffer will beNULL.- Returns:
(bool) Return value
- Returns:
(int[])
pArrayItemDefs- Returns:
(uint64[])
pCurrentPrices- Returns:
(uint64[])
pBasePrices- SteamWorks:
Signature differences from C++ API:
Parameter
pArrayItemDefsis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.Parameter
pCurrentPricesis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.Parameter
pBasePricesis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.
- Inventory.GetNumItemsWithPrices()ο
π€ Auto-generated binding
- Returns:
(int) Return value
- SteamWorks:
- Inventory.GetResultItemProperty(resultHandle, unItemIndex, pchPropertyName, punValueBufferSizeOut)ο
π€ Auto-generated binding
- Parameters:
resultHandle (int - SteamInventoryResult_t) β
unItemIndex (int) β
pchPropertyName (str?) β
punValueBufferSizeOut (int?) β size of the buffer to allocate for
pchValueBuffer. Ifnilthen the buffer will beNULL.
- Returns:
(bool) Return value
- Returns:
(str)
pchValueBuffer- Returns:
(int)
punValueBufferSizeOut- SteamWorks:
Signature differences from C++ API:
Parameter
pchValueBufferis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.Parameter
punValueBufferSizeOutis both an input and an output in C++: you pass the buffer size, and Steam writes the actual count back. luasteam returns it as an additional return value.
- Inventory.GetResultItems(resultHandle, punOutItemsArraySize)ο
π€ Auto-generated binding
- Parameters:
resultHandle (int - SteamInventoryResult_t) β
punOutItemsArraySize (int?) β size of the buffer to allocate for
pOutItemsArray. Ifnilthen the buffer will beNULL.
- Returns:
(bool) Return value
- Returns:
(SteamItemDetails_t[])
pOutItemsArray- Returns:
(int)
punOutItemsArraySize- SteamWorks:
Signature differences from C++ API:
Parameter
pOutItemsArrayis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.Parameter
punOutItemsArraySizeis both an input and an output in C++: you pass the buffer size, and Steam writes the actual count back. luasteam returns it as an additional return value.
Example:
function Steam.Inventory.OnSteamInventoryResultReady(data)
if data.m_result ~= Steam.k_EResultOK then return end
local _, items = Steam.Inventory.GetResultItems(data.m_handle, 256)
for _, item in ipairs(items) do
print('Item:', item.m_iDefinition, 'Qty:', item.m_unQuantity)
end
Steam.Inventory.DestroyResult(data.m_handle)
end
- Inventory.GetResultStatus(resultHandle)ο
π€ Auto-generated binding
- Parameters:
resultHandle (int - SteamInventoryResult_t) β
- Returns:
(int - EResult) Return value
- SteamWorks:
Example:
local status = Steam.Inventory.GetResultStatus(resultHandle)
if status == Steam.k_EResultOK then
processInventoryResult(resultHandle)
end
- Inventory.GetResultTimestamp(resultHandle)ο
π€ Auto-generated binding
- Parameters:
resultHandle (int - SteamInventoryResult_t) β
- Returns:
(int) Return value
- SteamWorks:
- Inventory.GrantPromoItems()ο
π€ Auto-generated binding
- Returns:
(bool) Return value
- Returns:
(int)
pResultHandle- SteamWorks:
Signature differences from C++ API:
Parameter
pResultHandleis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.
- Inventory.InspectItem(pchItemToken)ο
π€ Auto-generated binding
- Parameters:
pchItemToken (str?) β
- Returns:
(bool) Return value
- Returns:
(int)
pResultHandle- SteamWorks:
Signature differences from C++ API:
Parameter
pResultHandleis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.
- Inventory.LoadItemDefinitions()ο
π€ Auto-generated binding
- Returns:
(bool) Return value
- SteamWorks:
Example:
-- Trigger loading of item definitions; wait for OnSteamInventoryDefinitionUpdate
Steam.Inventory.LoadItemDefinitions()
- Inventory.RemoveProperty(handle, nItemID, pchPropertyName)ο
π€ Auto-generated binding
- Parameters:
handle (uint64 - SteamInventoryUpdateHandle_t) β
nItemID (uint64 - SteamItemInstanceID_t) β
pchPropertyName (str?) β
- Returns:
(bool) Return value
- SteamWorks:
- Inventory.RequestEligiblePromoItemDefinitionsIDs(steamID, callback)ο
π€ Auto-generated binding
- Parameters:
steamID (uint64 - CSteamID) β
callback (function) β CallResult callback receiving struct
SteamInventoryEligiblePromoItemDefIDs_tand a boolean
- Returns:
(uint64)
SteamAPICall_thandle for this async call. The result is delivered via thecallbackparameter whenSteam.RunCallbacks()is called.- SteamWorks:
- Inventory.RequestPrices(callback)ο
π€ Auto-generated binding
- Parameters:
callback (function) β CallResult callback receiving struct
SteamInventoryRequestPricesResult_tand a boolean- Returns:
(uint64)
SteamAPICall_thandle for this async call. The result is delivered via thecallbackparameter whenSteam.RunCallbacks()is called.- SteamWorks:
Example:
Steam.Inventory.RequestPrices(function(data, err)
if not err and data.m_result == Steam.k_EResultOK then
local numItems = Steam.Inventory.GetNumItemsWithPrices()
local ok, items, curPrices, basePrices = Steam.Inventory.GetItemsWithPrices(numItems)
if ok then
for i = 1, numItems do
print('Item', items[i], 'prices', curPrices[i], basePrices[i])
end
end
end
end)
- Inventory.SendItemDropHeartbeat()ο
π€ Auto-generated binding
- SteamWorks:
- Inventory.SetPropertyBool(handle, nItemID, pchPropertyName, bValue)ο
π€ Auto-generated binding
- Parameters:
handle (uint64 - SteamInventoryUpdateHandle_t) β
nItemID (uint64 - SteamItemInstanceID_t) β
pchPropertyName (str?) β
bValue (bool) β
- Returns:
(bool) Return value
- SteamWorks:
Signature differences from C++ API:
In C++, this is an overloaded method called
SetProperty. luasteam exposes each overload as a distinct function with a type suffix.
- Inventory.SetPropertyFloat(handle, nItemID, pchPropertyName, flValue)ο
π€ Auto-generated binding
- Parameters:
handle (uint64 - SteamInventoryUpdateHandle_t) β
nItemID (uint64 - SteamItemInstanceID_t) β
pchPropertyName (str?) β
flValue (float) β
- Returns:
(bool) Return value
- SteamWorks:
Signature differences from C++ API:
In C++, this is an overloaded method called
SetProperty. luasteam exposes each overload as a distinct function with a type suffix.
- Inventory.SetPropertyInt64(handle, nItemID, pchPropertyName, nValue)ο
π€ Auto-generated binding
- Parameters:
handle (uint64 - SteamInventoryUpdateHandle_t) β
nItemID (uint64 - SteamItemInstanceID_t) β
pchPropertyName (str?) β
nValue (uint64) β
- Returns:
(bool) Return value
- SteamWorks:
Signature differences from C++ API:
In C++, this is an overloaded method called
SetProperty. luasteam exposes each overload as a distinct function with a type suffix.
- Inventory.SetPropertyString(handle, nItemID, pchPropertyName, pchPropertyValue)ο
π€ Auto-generated binding
- Parameters:
handle (uint64 - SteamInventoryUpdateHandle_t) β
nItemID (uint64 - SteamItemInstanceID_t) β
pchPropertyName (str?) β
pchPropertyValue (str?) β
- Returns:
(bool) Return value
- SteamWorks:
Signature differences from C++ API:
In C++, this is an overloaded method called
SetProperty. luasteam exposes each overload as a distinct function with a type suffix.
- Inventory.StartPurchase(pArrayItemDefs, punArrayQuantity, unArrayLength, callback)ο
π€ Auto-generated binding
- Parameters:
pArrayItemDefs (int[]?) β
punArrayQuantity (int[]?) β
unArrayLength (int) β size of the input arrays
pArrayItemDefsandpunArrayQuantitycallback (function) β CallResult callback receiving struct
SteamInventoryStartPurchaseResult_tand a boolean
- Returns:
(uint64)
SteamAPICall_thandle for this async call. The result is delivered via thecallbackparameter whenSteam.RunCallbacks()is called.- SteamWorks:
Example:
Steam.Inventory.StartPurchase({itemDefID}, {1}, 1, function(data, err)
if not err and data.m_result == Steam.k_EResultOK then
print('Purchase started, orderID:', tostring(data.m_ulOrderID))
end
end)
- Inventory.StartUpdateProperties()ο
π€ Auto-generated binding
- Returns:
(uint64 - SteamInventoryUpdateHandle_t) Return value
- SteamWorks:
- Inventory.SubmitUpdateProperties(handle)ο
π€ Auto-generated binding
- Parameters:
handle (uint64 - SteamInventoryUpdateHandle_t) β
- Returns:
(bool) Return value
- Returns:
(int)
pResultHandle- SteamWorks:
Signature differences from C++ API:
Parameter
pResultHandleis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.
- Inventory.TradeItems(steamIDTradePartner, pArrayGive, pArrayGiveQuantity, nArrayGiveLength, pArrayGet, pArrayGetQuantity, nArrayGetLength)ο
π€ Auto-generated binding
- Parameters:
steamIDTradePartner (uint64 - CSteamID) β
pArrayGive (uint64[]?) β
pArrayGiveQuantity (int[]?) β
nArrayGiveLength (int) β size of the input arrays
pArrayGiveandpArrayGiveQuantitypArrayGet (uint64[]?) β
pArrayGetQuantity (int[]?) β
nArrayGetLength (int) β size of the input arrays
pArrayGetandpArrayGetQuantity
- Returns:
(bool) Return value
- Returns:
(int)
pResultHandle- SteamWorks:
Signature differences from C++ API:
Parameter
pResultHandleis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.
- Inventory.TransferItemQuantity(itemIdSource, unQuantity, itemIdDest)ο
π€ Auto-generated binding
- Parameters:
itemIdSource (uint64 - SteamItemInstanceID_t) β
unQuantity (int) β
itemIdDest (uint64 - SteamItemInstanceID_t) β
- Returns:
(bool) Return value
- Returns:
(int)
pResultHandle- SteamWorks:
Signature differences from C++ API:
Parameter
pResultHandleis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.
Example:
-- Split a stack: move 5 units to a new stack
local ok, resultHandle = Steam.Inventory.TransferItemQuantity(sourceItemID, 5, 0)
- Inventory.TriggerItemDrop(dropListDefinition)ο
π€ Auto-generated binding
- Parameters:
dropListDefinition (int - SteamItemDef_t) β
- Returns:
(bool) Return value
- Returns:
(int)
pResultHandle- SteamWorks:
Signature differences from C++ API:
Parameter
pResultHandleis not a parameter in Lua β it is an output-only pointer in C++ and is returned as an additional return value.
Example:
local ok, resultHandle = Steam.Inventory.TriggerItemDrop(dropListDefinitionID)
-- Triggers a potential item drop for playtime rewards
Unimplemented Methodsο
- Inventory.SerializeResult()ο
β Not implemented - blocklist: Uses nullptr as input, we donβt support it
- SteamWorks:
Callbacksο
- Inventory.OnSteamInventoryResultReady()ο
Callback for SteamInventoryResultReady_t
callback(data) receives:
data.m_handle (int - SteamInventoryResult_t)
data.m_result (int - EResult)
- Inventory.OnSteamInventoryFullUpdate()ο
Callback for SteamInventoryFullUpdate_t
callback(data) receives:
data.m_handle (int - SteamInventoryResult_t)
- Inventory.OnSteamInventoryDefinitionUpdate()ο
Callback for SteamInventoryDefinitionUpdate_t
callback(data) receives no fields (notification only).
Example:
function Steam.Inventory.OnSteamInventoryDefinitionUpdate()
print('Item definitions updated')
local ids = Steam.Inventory.GetItemDefinitionIDs(256)
print('Loaded', #ids, 'item definitions')
end
- Inventory.OnSteamInventoryEligiblePromoItemDefIDs()ο
Callback for SteamInventoryEligiblePromoItemDefIDs_t
callback(data) receives:
data.m_result (int - EResult)
data.m_steamID (uint64 - CSteamID)
data.m_numEligiblePromoItemDefs (int)
data.m_bCachedData (bool)
- Inventory.OnSteamInventoryStartPurchaseResult()ο
Callback for SteamInventoryStartPurchaseResult_t
callback(data) receives:
data.m_result (int - EResult)
data.m_ulOrderID (uint64)
data.m_ulTransID (uint64)
- Inventory.OnSteamInventoryRequestPricesResult()ο
Callback for SteamInventoryRequestPricesResult_t
callback(data) receives:
data.m_result (int - EResult)
data.m_rgchCurrency (string)
Example:
function Steam.Inventory.OnSteamInventoryRequestPricesResult(data)
if data.m_result == Steam.k_EResultOK then
print('Currency:', data.m_rgchCurrency)
end
end