API:GetBankData
From RoR Wiki
UI Lua API · Item functions
Version: WAR 1.4.8
Returns the items in the player's bank, one table per bank slot.
items = GetBankData()
Arguments
None.
Returns
- items
table– Array of item data tables, indexed by bank slot from 1.
Details
- There is one entry for every bank slot the player has, including empty slots. An empty slot has an item table with default values (
id0, emptyname). - If the Lua state is not available, the function returns nothing. Unlike the other item getters, it does not check for a player object before reading the bank size, so only call it while the player is in the world.
- A new table is built on every call. The stock UI caches it in
DataUtils.GetBankData()(easystem_utils/source/datautils.lua) and rebuilds it only whenGameData.Player.bankItemsDirtyis set. To refresh a single slot, the stock bank window uses GetSingleItem.
Errors
None.
Example
From default/easystem_utils/source/datautils.lua:
function DataUtils.GetBankData ()
if (GameData.Player.bankItemsDirty)
then
GameData.Player.bankItemsDirty = false
DataUtilsData.bankItems= GetBankData()
end
return DataUtilsData.bankItems
end
