Skip to content
lsl.devlsl.devLSL Dev

llGetInventoryName

function
Function syntax
string llGetInventoryName(
  1. integer type,// INVENTORY_* type constant of the item. Values: InventoryType
  2. integer index// Index of the item of that type.
);
Returns
string
Energy
10

Inventory items are sorted in alphabetical order (not chronological order).

Returns a string that is the name of the inventory item number of type. Returns an empty string if no item of the specified type is found in the prim’s inventory (or there are less than or equal to number items of the type).

How to use
string result = llGetInventoryName(0, 0);
FlagInventory Type
INVENTORY_NONE-1Item does not exist.
INVENTORY_ALLAny inventory type.
INVENTORY_TEXTURE0texture
INVENTORY_SOUND1sound
INVENTORY_LANDMARK3landmark
INVENTORY_CLOTHING5clothing
INVENTORY_OBJECT6object
FlagInventory Type
INVENTORY_NOTECARD7notecard
INVENTORY_SCRIPT10script
INVENTORY_BODYPART13body part
INVENTORY_ANIMATION20animation
INVENTORY_GESTURE21gesture
INVENTORY_SETTING56setting
INVENTORY_MATERIAL57material
Example 1
10 collapsed lines
// Give all prim contents to anyone touching this object,
// But don't give this script itself.
default
{
touch_start(integer num_detected)
{
list InventoryList;
integer count = llGetInventoryNumber(INVENTORY_ALL); // Count of all items in prim's contents
string ItemName;
while (count--)
{
ItemName = llGetInventoryName(INVENTORY_ALL, count);
if (ItemName != llGetScriptName() )
InventoryList += ItemName; // add all contents except this script, to a list
5 collapsed lines
}
// Give all the items to the toucher, in a folder named as per this prim's name
llGiveInventoryList(llDetectedKey(0), llGetObjectName(), InventoryList);
}
}

The maximum number of characters for an object inventory item is currently 63 characters.

Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.