Skip to main content

sm.terrainData

The data manager helps storing script data, both locally and between server and client in multiplayer games.

Functions

exists

sm.terrainData.exists()

Checks if terrain data exists for the current world.

Returns:
  • [ bool ]: Whether the world has terrain data or not.

legacy_getData

sm.terrainData.legacy_getData()
warning

Deprecated! Use sm.terrainData.load()

Legacy function for reading creative terrain. Do not use.

Returns:
  • [ string ]: The serialized bitser data.

legacy_loadTerrainData

sm.terrainData.legacy_loadTerrainData( id )
warning

Deprecated! Use sm.terrainData.load()

Legacy function for reading creative custom terrain. Do not use.

Arguments:
  • id [ int ]: The id.
Returns:
  • [ any ]: The data. Any Lua object.

legacy_saveTerrainData

sm.terrainData.legacy_saveTerrainData( id, data )
warning

Deprecated! Use sm.terrainData.save()

Legacy function for storing creative custom terrain. Do not use.

Arguments:
  • id [ int ]: The id.
  • data [ any ]: The data.

legacy_setData

sm.terrainData.legacy_setData( data )
warning

Deprecated! Use sm.terrainData.save()

Legacy function for storing creative custom terrain. Do not use.

Arguments:
  • data [ string ]: The serialized bitser data.

load

sm.terrainData.load()

Loads the world's terrain data, if available.

Returns:
  • [ 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.

Arguments:
  • data [ any ]: The data. Any Lua object.