Callback
Signature
table onSave(string filepath)
Description
The callback function that is responsible for storing the data in the JSON file when save data is saved.
Returning an empty table ({}
) will delete the save data for the identifier whereas returning nil
or nothing will keep it.
Arguments
File Path
The path of the save game.
Example
Callback
local function onSave()
return {
name2 = {11, 22, 33}, --array
name1 = "value1", --string
name3 = { --table
[1] = "aa",
nn = "bb", --makes it a table rather than an array
[3] = "cc"
}
}
end
event.registerSaveHandler("test", onSave)
Output
{
"name1": "value1",
"name2": [
11,
22,
33
],
"name3": {
"1": "aa",
"3": "cc",
"nn": "bb"
}
}
Notes
Only the following value types are supported: table
, string
, double
, integer
, bool
.
Last updated