sm
The sm namespace contain all API features related to Scrap Mechanic.
Constants:
Functions:
sm.isHost boolean
Returns whether the game is currently running on the hosting player's computer.
sm.version string
Returns the current version of the game as a string.
sm.exists(object)
Returns whether an object exists in the game. This is useful for checking whether a reference to an object is valid.
Parameters:
Type | Name | Description |
---|---|---|
any | object | The object instance. |
Returns:
Type | Description |
---|---|
boolean | Whether the object exists. |
sm.isServerMode()
Returns whether the script is currently running in server mode. Otherwise, it is running in client mode. Server mode only occurs when sm.isHost is true.
Returns:
Type | Description |
---|---|
boolean | Whether the script is running in server mode. |