mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 21:10:36 +00:00
31 lines
903 B
Lua
31 lines
903 B
Lua
local fs = require("@lune/fs")
|
|
local roblox = require("@lune/roblox")
|
|
local Instance = roblox.Instance
|
|
|
|
local game = Instance.new("DataModel")
|
|
|
|
local workspace = game:GetService("Workspace")
|
|
|
|
local model = Instance.new("Model")
|
|
local part = Instance.new("Part")
|
|
|
|
part.Parent = model
|
|
model.Parent = workspace
|
|
|
|
local placeAsBinary = roblox.serializePlace(game)
|
|
local placeAsXml = roblox.serializePlace(game, true)
|
|
|
|
fs.writeFile("bin/temp-place.rbxl", placeAsBinary)
|
|
fs.writeFile("bin/temp-place.rbxlx", placeAsXml)
|
|
|
|
local savedFileBinary = fs.readFile("bin/temp-place.rbxl")
|
|
local savedFileXml = fs.readFile("bin/temp-place.rbxlx")
|
|
|
|
local savedBinary = roblox.deserializePlace(savedFileBinary)
|
|
local savedXml = roblox.deserializePlace(savedFileXml)
|
|
|
|
assert(savedBinary.Name ~= "ROOT")
|
|
assert(savedXml.Name ~= "ROOT")
|
|
|
|
assert(savedBinary.ClassName == "DataModel")
|
|
assert(savedXml.ClassName == "DataModel")
|