# sm.unit.getAllUnits

Returns a table with all the units in the world.

**Kind:** Function

**Environments:** Game

## Game

``` { .lua .api-signature }
sm.unit.getAllUnits( world? )
```

[Open the full Game reference](../Game-Script-Environment/Static-Functions/sm.unit.md#getallunits)

**Availability:** Server only

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `world` *(optional)* | [World](../Game-Script-Environment/Userdata/World.md) | The world to get units from. Defaults to the world of the script (Optional) |

**Returns:**

| Type | Description |
| --- | --- |
| table | The table of all units. \{[Unit](../Game-Script-Environment/Userdata/Unit.md), ..\} |
