# llGetLinkPrimitiveParams

*LSL function*

```lsl
list list llGetLinkPrimitiveParams(integer link, list params);
```

- `integer link`: Link number (1 for root, >1 for children) or a LINK_* flag to retrieve parameters from.
- `list params`: A list of PRIM_* flags specifying the attributes to retrieve.

- Returns: `list`
- Energy: 10

These functions are very similar; the difference is the latter takes a **link** parameter, and does not cause the script to sleep.

PRIM\_\* flags can be broken into three categories, face flags, prim flags, and object flags.

- Supplying a prim or object flag will return that flag's attributes.
- Face flags require the user to also supply a side parameter.

Identical to [llGetPrimitiveParams](/functions/llGetPrimitiveParams/) except that it acts on the prim specified by the **link** number given.

```lsl title="How to use" frame="terminal"
list result = llGetLinkPrimitiveParams(0, []);
```

## Specification

Constant group [PrimParam](/constants/groups/PrimParam/):

```lsl
PRIM_ALLOW_UNSIT = 39
PRIM_ALPHA_MODE, integer face, integer alpha_mode, integer mask_cutoff
PRIM_BUMP_SHINY, integer face, integer shiny, integer bump
PRIM_CLICK_ACTION = 43
PRIM_COLLISION_SOUND, string sound, float volume
PRIM_COLOR, integer face, vector color, float alpha
PRIM_DAMAGE, float damage, integer damage_type
PRIM_DESC = 28
PRIM_FLEXIBLE, integer enabled, integer softness, float gravity, float friction, float wind, float tension, vector force
PRIM_FULLBRIGHT, integer face, integer enabled
PRIM_GLOW, integer face, float intensity
PRIM_GLTF_BASE_COLOR, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians, vector color, float alpha, integer gltf_alpha_mode, float alpha_mask_cutoff, integer double_sided
PRIM_GLTF_EMISSIVE, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians, vector emissive_tint
PRIM_GLTF_METALLIC_ROUGHNESS, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians, float metallic_factor, float roughness_factor
PRIM_GLTF_NORMAL, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians
PRIM_HEALTH = 52
PRIM_LINK_TARGET = 34
PRIM_MATERIAL = 2
PRIM_NAME = 27
PRIM_NORMAL, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians
PRIM_OMEGA, vector axis, float spinrate, float gain
PRIM_PHANTOM = 5
PRIM_PHYSICS = 3
PRIM_PHYSICS_SHAPE_TYPE = 30
PRIM_POINT_LIGHT, integer enabled, vector linear_color, float intensity, float radius, float falloff
PRIM_POS_LOCAL = 33
PRIM_POSITION = 6
PRIM_PROJECTOR, string texture, float fov, float focus, float ambiance
PRIM_REFLECTION_PROBE, integer enabled, float ambiance, float clip_distance, integer flags
PRIM_RENDER_MATERIAL, integer face, string render_material
PRIM_ROT_LOCAL = 29
PRIM_ROTATION = 8
PRIM_SCRIPTED_SIT_ONLY = 40
PRIM_SIT_FLAGS = 50
PRIM_SIT_TARGET, integer sit_target, vector offset, rotation rot
PRIM_SIZE = 7
PRIM_SLICE = 35
PRIM_SPECULAR, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians, vector color, integer glossiness, integer environment
PRIM_TEMP_ON_REZ = 4
PRIM_TEXGEN, integer face, integer mode
PRIM_TEXT, string text, vector color, float alpha
PRIM_TEXTURE, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians
PRIM_TYPE = 9
```

Each rule is followed by its request arguments; the result list holds the values after the arrow, in rule order.

### Shape

<table class="params-list">
	<tr>
		<th>Rule</th>
		<th>Description</th>
	</tr>
	<tr>
		<td>[PRIM_TYPE](/constants/PRIM_TYPE/) →

`integer flag, …`

</td>
		<td>Gets the prim's shape. The PRIM_TYPE_* flag picks the shape and the arguments that follow it. **hole_shape** is one of [PRIM_HOLE_*](/constants/groups/PrimTypeHole/); a sculpt's **type** is one of [PRIM_SCULPT_TYPE_*](/constants/groups/PrimTypeSculptType/), optionally combined with [PRIM_SCULPT_FLAG_*](/constants/groups/PrimTypeSculptFlag/). Has no effect on mesh. Forms:<ul><li>

`PRIM_TYPE_BOX, integer hole_shape, vector cut, float hollow, vector twist, vector top_size, vector top_shear`

</li><li>

`PRIM_TYPE_CYLINDER, integer hole_shape, vector cut, float hollow, vector twist, vector top_size, vector top_shear`

</li><li>

`PRIM_TYPE_PRISM, integer hole_shape, vector cut, float hollow, vector twist, vector top_size, vector top_shear`

</li><li>

`PRIM_TYPE_SPHERE, integer hole_shape, vector cut, float hollow, vector twist, vector dimple`

</li><li>

`PRIM_TYPE_TORUS, integer hole_shape, vector cut, float hollow, vector twist, vector hole_size, vector top_shear, vector advanced_cut, vector taper, float revolutions, float radius_offset, float skew`

</li><li>

`PRIM_TYPE_TUBE, integer hole_shape, vector cut, float hollow, vector twist, vector hole_size, vector top_shear, vector advanced_cut, vector taper, float revolutions, float radius_offset, float skew`

</li><li>

`PRIM_TYPE_RING, integer hole_shape, vector cut, float hollow, vector twist, vector hole_size, vector top_shear, vector advanced_cut, vector taper, float revolutions, float radius_offset, float skew`

</li><li>

`PRIM_TYPE_SCULPT, string map, integer type`

</li></ul></td>
	</tr>
</table>

## Shared wiki article

This page transcludes [LlGetPrimitiveParams](/functions/llGetPrimitiveParams/). The following text is from that archived revision.

## Caveats

- [PRIM_LINK_TARGET](/constants/PRIM_LINK_TARGET/) is a special parameter which can be inserted to perform actions on multiple prims on the linkset with one call.
  - Passing 0 (zero) as the link number in the formal **link** parameter on a linked object will return an empty list.
- The legacy value of [PRIM_TYPE](/constants/PRIM_TYPE/), 1 (which is often referred to as PRIM_TYPE_LEGACY), is not supported by this function as a flag[^wiki-56d80c].

[^wiki-56d80c]: [llGetPrimitiveParams](/functions/llGetPrimitiveParams/) came after PRIM_TYPE_LEGACY was deprecated.

## Examples

<details open>
<summary>To test whether an object is a point light source, and if so get its parameters:</summary>

```lsl
default
{
    state_entry()
    {
        list    params  = llGetPrimitiveParams([PRIM_POINT_LIGHT]);
        integer isLight = llList2Integer(params, 0);

        string msg = "Object is ";

        if (!isLight) // read as "not isLight"
            msg += "not a light source.";
        else
        {
            msg += "a point light source.";

        //  llList2String will automatically typecast

            msg += "\n\tColour    = " + llList2String(params, 1);
            msg += "\n\tIntensity = " + llList2String(params, 2);
            msg += "\n\tRadius    = " + llList2String(params, 3);
            msg += "\n\tFalloff   = " + llList2String(params, 4);
        }

        llSay(0, msg);
    }
}
```

</details>

<details>
<summary>Example 2</summary>

```lsl collapse={1-14, 23-35}
//code snippets by Strife Onizuka, Xen Lisle and Kireji Haiku
integer AreAllPrimsAreGlowing()
{
	//The root prim is either link number is 0 or 1
	//It is only zero if it is a single prim object with no avatars sitting on it.
	//llGetNumberOfPrims() returns the number of prims and seated avatars.
	integer link = llGetNumberOfPrims() > 1;

	//We want to loop over all prims but not avatars, so we need to know how many prims there are.
	//Fortunately the avatars are added to the end of the link set, their link numbers always come after the last prim.
	//llGetObjectPrimCount(llGetKey()) only returns only the number of prims, it doesn't count avatars.
	//To determine the upper bound, we need to take into consideration the link number of the root prim.
	integer end = link + llGetObjectPrimCount(llGetKey());

	for(;link < end; ++link)//loop through all prims
	{
		if( llListStatistics(LIST_STAT_MAX, llGetLinkPrimitiveParams(link, [PRIM_GLOW, ALL_SIDES])) <= 0.0)
		{//we can exit early because we know that if this value is less than or equal to zero, so will the minimum
			return FALSE;
		}
	}
	//we didn't find a single value that was less than or equal to zero, QED, they are all greater than zero.
	return TRUE;
}

default
{
	touch_start(integer num_detected)
	{
		if(AreAllPrimsAreGlowing())
			llSay(0, "All prims glowing.");
		else
			llSay(0, "Not all prims glowing.");
	}
}
```

</details>

## Helper functions

```lsl collapse={1-12}
list GetPrimitiveParams(list input)
{//Returns a list that can be fed to llSetPrimitiveParams
    integer link = LINK_THIS;
    list output;
    integer c = ~llGetListLength(input);
    while(0x80000000 & (c = - ~c))
    {
        integer f = llList2Integer(input, c);
        list flag = (list)f;
        if(~llListFindList([PRIM_BUMP_SHINY, PRIM_COLOR, PRIM_TEXTURE,
                            PRIM_FULLBRIGHT, PRIM_TEXGEN, PRIM_GLOW], flag ))
        {
            integer side = llList2Integer(input, (c = - ~c));
            if(~side)//pop the stack
                output += flag + side + llGetLinkPrimitiveParams(link, flag + side );
            else
                for(side = llGetLinkNumberOfSides(link); side; ) //we return the sides in reverse order, easier to code; runs faster.
                    output += flag + side + llGetLinkPrimitiveParams(link, flag + (side = ~ -side) );
        }
        else if(PRIM_LINK_TARGET ^ f)
            output += flag + (link = llList2Integer(input, (c = - ~c)));
        else
            output += flag + llGetLinkPrimitiveParams(link, flag );
    }
    return output;
}
//Contributed by Strife Onizuka
```

```lsl collapse={1-11}
list GetLinkPrimitiveParams(integer link, list input)
{//Returns a list that can be fed to llSetPrimitiveParams
    list output;
    integer c = ~llGetListLength(input);
    while(0x80000000 & (c = - ~c))
    {
        integer f = llList2Integer(input, c);
        list flag = (list)f;
        if(~llListFindList([PRIM_BUMP_SHINY, PRIM_COLOR, PRIM_TEXTURE,
                            PRIM_FULLBRIGHT, PRIM_TEXGEN, PRIM_GLOW], flag ))
        {
            integer side = llList2Integer(input, (c = - ~c));
            if(~side)//pop the stack
                output += flag + side + llGetLinkPrimitiveParams(link, flag + side );
            else
                for(side = llGetLinkNumberOfSides(link); side; ) //we return the sides in reverse order, easier to code; runs faster.
                    output += flag + side + llGetLinkPrimitiveParams(link, flag + (side = ~ -side) );
        }
        else if(PRIM_LINK_TARGET ^ f)
            output += flag + (link = llList2Integer(input, (c = - ~c)));
        else
            output += flag + llGetLinkPrimitiveParams(link, flag );
    }
    return output;
}
//Contributed by Strife Onizuka
```

[SetPrimitiveParams-Example](https://wiki.secondlife.com/wiki/User:Anylyn_Hax#setprimitiveparams-example) by Anylyn Hax makes reading primitive parameters easy.

[SetPrimitiveParams-Example](https://wiki.secondlife.com/wiki/User:Anylyn_Hax#llsetprimitiveparams-28-29-example2-human-readable-using-all-sides) by Anylyn Hax makes reading primitive parameters easy.

## History

- Date of release `llGetLinkPrimitiveParams` [29-03-2010](https://wiki.secondlife.com/wiki/Release_Notes/Second_Life_Server/1.38#new-features)

## Related functions

The original wiki page documents these functions together with this one:

- [llGetPrimitiveParams](/functions/llGetPrimitiveParams/)

## See also

### Functions

- [llSetLinkPrimitiveParamsFast](/functions/llSetLinkPrimitiveParamsFast/) — Set parameters on other prims in linkset without sleep
- [llGetObjectDetails](/functions/llGetObjectDetails/)

---

*Source: [LlGetPrimitiveParams](https://wiki.secondlife.com/wiki/LlGetPrimitiveParams#llGetLinkPrimitiveParams) on the Second Life Wiki. Content from the Second Life Wiki articles LlGetPrimitiveParams (revision 1204754, 2016-10-21), Template:LSL Function/link-face (revision 1186827, 2014-01-12) and Template:LSL PrimitiveParam Categorize (revision 1180644, 2013-08-09), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llGetLinkPrimitiveParams/
