sm.terrainData

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

Functions:

  • exists
  • legacy_getData
  • legacy_loadTerrainData
  • legacy_saveTerrainData
  • legacy_setData
  • load
  • save

  • sm.terrainData.exists()

    Check if terrain data exists for this world.

    Returns:

    TypeDescription
    booleanTrue if data exists. False otherwise.

    sm.terrainData.legacy_getData()

    Deprecated:

    Use sm.terrainData.load

    Legacy function for reading creative terrain. Do not use.

    Returns:

    TypeDescription
    stringThe serialized bitser data.

    sm.terrainData.legacy_loadTerrainData(id)

    Deprecated:

    Use sm.terrainData.load

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

    Parameters:

    TypeNameDescription
    integeridThe id.

    Returns:

    TypeDescription
    anyThe data. Any lua object.

    sm.terrainData.legacy_saveTerrainData(id, data)

    Deprecated:

    Use sm.terrainData.save

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

    Parameters:

    TypeNameDescription
    integeridThe id.
    anydataThe data. Any lua object.

    sm.terrainData.legacy_setData(data)

    Deprecated:

    Use sm.terrainData.save

    Legacy function for storing creative terrain. Do not use.

    Parameters:

    TypeNameDescription
    stringdataThe serialized bitser data.

    sm.terrainData.load()

    Load terrain data for this world if available.

    Returns:

    TypeDescription
    anyThe data. Any lua object.

    sm.terrainData.save(data)

    Save and share terrain data over network from server to client.

    The data is accessible from the same world.

    Parameters:

    TypeNameDescription
    anydataThe data. Any lua object.