sm.terrainData
The data manager helps storing script data, both locally and between server and client in multiplayer games.
Functions
exists
sm.terrainData.exists( )
Check if terrain data exists for this world.
Returns:
| Type | Description |
|---|---|
| boolean | True if data exists. False otherwise. |
legacy_getData
sm.terrainData.legacy_getData( )
Deprecated: Use sm.terrainData.load
Legacy function for reading creative terrain. Do not use.
Returns:
| Type | Description |
|---|---|
| string | The serialized bitser data. |
legacy_loadTerrainData
sm.terrainData.legacy_loadTerrainData( id )
Deprecated: Use sm.terrainData.load
Legacy function for reading creative custom terrain. Do not use.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
integer | The id. |
Returns:
| Type | Description |
|---|---|
| any | The data. Any lua object. |
legacy_saveTerrainData
sm.terrainData.legacy_saveTerrainData( id, data )
Deprecated: Use sm.terrainData.save
Legacy function for storing creative custom terrain. Do not use.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
integer | The id. |
data |
any | The data. Any lua object. |
legacy_setData
sm.terrainData.legacy_setData( data )
Deprecated: Use sm.terrainData.save
Legacy function for storing creative terrain. Do not use.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
string | The serialized bitser data. |
load
sm.terrainData.load( )
Load terrain data for this world if available.
Returns:
| Type | Description |
|---|---|
| any | The data. Any lua object. |
save
sm.terrainData.save( data )
Save and share terrain data over network from server to client.
The data is accessible from the same world.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
any | The data. Any lua object. |