CreatorsServer exports
CountInStash
Last updated on
How many units of an item a stash holds.
local res = exports.opx_infinity:CountInStash(stash, item, metadata)Scope read · must be awaited — a synchronous call answers export.mustAwait.
Parameters
-
stash:
string -
item:
string -
metadata?:
table -
stashis the storage key, 1–48 characters: letters, digits,_,-,.. -
The stash is loaded, never opened in front of a player. One loaded this way and not opened by a player is saved and put away
STASHES.IDLE_MS(60 s) after its last use. -
countis 1–1 000 000, default 1; withmetadata, only stacks with exactly that metadata match.
Returns
integer—0for a stash that does not exist (none is created)
Errors
export.badArgument, inventory codes
CreateThread(function()
local pending, why = Open77.exports.call('opx_infinity', 'CountInStash', 'my_shop.backroom', 'water')
if not pending then return print('not sent: ' .. tostring(why)) end
local res = pending:await()
if not (res and res.ok) then return print('refused: ' .. tostring(res and res.error)) end
print(res.value .. ' left')
end)