This method will be called when loading the game from a save file. Specifying the load method alone is not enough to make the game load whatever mod data you might need loading. For that, look into game.addLoadComponent.
If no data was saved previously (ie. loading an existing save file after installing a new mod) this method will not be called.
myModClass = {}
myModClass.id = "myUniqueModID"
myModClass.priority = 1
function myModClass:remove()
end
function myModClass:load(loadedData)
if loadedData then
self.someVarOne = loadedData.someVarOne
self.someVarTwo = loadedData.someVarTwo
end
end
function myModClass:save()
return {
someVarOne = self.someVarOne,
someVarTwo = self.someVarTwo
}
end
game.addLoadComponent(myModClass, myModClass.id, myModClass.priority)