---
title: slot_type
description: >-
  Retrieve the field code of an object in a slot and, optionally, some other
  information
---
import { Tabs, TabItem } from '@astrojs/starlight/components';

### Behaviour

<Tabs>
<TabItem label="C">
* Locate the object pointed to by the specified `slot_no`
* Determine its `sf` field code and return this, or some other information (see below) if `flags` are used
</TabItem>

<TabItem label="JavaScript">
* Retrieves the type of the specified slot.
* Returns an error code or the type of the slot.
</TabItem>
</Tabs>

### Definition

<Tabs>
<TabItem label="C">
```c
int64_t slot_type (
    uint32_t slot_no,
    uint32_t flags
);
```
</TabItem>

<TabItem label="JavaScript">
```javascript
function slot_type(slotno: number, flags: number): ErrorCode | number
```
</TabItem>
</Tabs>



### Example

<Tabs>
<TabItem label="C">
```c
int64_t fidle_code = 
    slot_type(1, 0);
```
</TabItem>

<TabItem label="JavaScript">
```javascript
const field_code = slot_type(1, 0)
```
</TabItem>
</Tabs>



### Parameters

<Tabs>
<TabItem label="C">
| Name     | Type      | Description                                                                                                                                                                                                          |
| -------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| slot_no | uint32_t | The slot number                                                                                                                                                                                                      |
| flags    | uin32_t  | <p>For normal operation this should be <code>0</code>.<br /><br />To determine whether or not an <code>STI_AMOUNT</code> type contains a native (XAH) amount or a floating point (IOU) amount set to <code>1</code>.</p> |
</TabItem>

<TabItem label="JavaScript">
| Name   | Type   | Description                           |
| ------ | ------ | ------------------------------------- |
| slotno | number | The slot number to check the type of. |
| flags  | number | Flags to determine the type.          |
</TabItem>
</Tabs>



### Return Code

<Tabs>
<TabItem label="C">
| Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| -------- |   |
| int64_t | <p>If <code>flags</code> is <code>0</code> then:<br />The <code>sf</code> field code of the slotted object<br /><br />If <code>flags</code> is <code>1</code> then:<br /><code>1</code> if and only if the slotted object is an <code>STI_AMOUNT</code> and the type of the amount is XAH.<br /><br />If negative, an error:<br /><code>DOESNT_EXIST</code><br />- the specified <code>slot_no</code> does not contain an object.<br /><br /><code>NOT_AN_AMOUNT</code><br />- <code>flags</code> was set to <code>1</code> but the slotted object is not an <code>STI_AMOUNT</code> object</p> |
</TabItem>

<TabItem label="JavaScript">
| Type                | Description                                    |
| ------------------- | ---------------------------------------------- |
| ErrorCode or number | Returns an error code or the type of the slot. |
</TabItem>
</Tabs>

