Classes

Concepts

loadComponent »

Libraries

Objects

load

Description

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.

Arguments

1 table loadedData

The loaded mod data that was saved to a save file previously.

Example

function myModClass:load(loadedData)
	-- since mod data is not guaranteed to be in a savefile upon loading (ie. start game without mod, save game, install mod, load game)

	-- you will need to check whether the data is present at all

	
	local saveData = loadedData.myModData

	if saveData then
		self.someVarOne = loadedData.myModData.someDataOne
		self.someVarTwo = data.someDataTwo
	end
end