SerializationService

Up and coming: shot check knows this class and its members today, and programs run it once the native runtime lands.

ShotInstanceservicenot creatablecomingData and time

Up and coming

Save objects as text, load them back, and keep numbered versions.

use SerializationService gives it. Serialize writes the instance lines of the project file, the same text the Explorer's copy puts on the clipboard, so one format serves the project, the clipboard and your saves. SaveVersionAsync writes each version as a numbered .shotsystem file that shot open shows.

A service: write use SerializationService.

Passes shot check todayLuau
local function example(x : SerializationService)
	local copies, why = x:Deserialize(x:Serialize({ Instance.new("Folder") :: any }))
	print(copies, why)
end

Methods

NameArgumentsReturnsDescription
Serialize(instances: { ShotInstance })stringThe instances and their children as the project file's instance lines, the same text the Explorer's copy puts on the clipboard.
Deserialize(text: string)({ ShotInstance }?, string?)Unparented copies with new ids, as a paste in Studio makes them; nil and "line N: ..." when the text is bad.
SaveVersionAsync
yields
(folder: PathHandler, instances: { ShotInstance })(number?, string?)Writes the instances as the folder's next numbered .shotsystem file, one past the highest there, and returns its number.
GetVersionsAsync
yields
(folder: PathHandler)({ number }?, string?)
LoadVersionAsync
yields
(folder: PathHandler, version: number?)({ ShotInstance }?, string?)Loads a saved version's instances; with no version, the highest.
ReadRobloxFileAsync
yields
(path: PathHandler)({ ShotInstance }?, string?)Reads the instances of a .rbxm, .rbxmx, .rbxl or .rbxlx file, outside the run's tree.
From ShotInstance 33