2023-05-20 13:23:51 +01:00
|
|
|
local fs = require("@lune/fs")
|
2023-05-20 18:49:37 +01:00
|
|
|
local roblox = require("@lune/roblox")
|
2023-03-22 12:02:05 +00:00
|
|
|
local Instance = roblox.Instance
|
|
|
|
|
|
|
|
local instances = {
|
|
|
|
Instance.new("Model"),
|
|
|
|
Instance.new("Part"),
|
|
|
|
}
|
|
|
|
|
2023-05-20 13:23:51 +01:00
|
|
|
local modelAsBinary = roblox.serializeModel(instances)
|
|
|
|
local modelAsXml = roblox.serializeModel(instances, true)
|
2023-03-23 08:42:24 +00:00
|
|
|
|
2023-05-20 13:23:51 +01:00
|
|
|
fs.writeFile("bin/temp-model.rbxm", modelAsBinary)
|
|
|
|
fs.writeFile("bin/temp-model.rbxmx", modelAsXml)
|
|
|
|
|
|
|
|
local savedFileBinary = fs.readFile("bin/temp-model.rbxm")
|
|
|
|
local savedFileXml = fs.readFile("bin/temp-model.rbxmx")
|
|
|
|
|
|
|
|
local savedBinary = roblox.deserializeModel(savedFileBinary)
|
|
|
|
local savedXml = roblox.deserializeModel(savedFileXml)
|
2023-03-23 08:42:24 +00:00
|
|
|
|
|
|
|
assert(savedBinary[1].Name ~= "ROOT")
|
|
|
|
assert(savedXml[1].Name ~= "ROOT")
|
|
|
|
|
|
|
|
assert(savedBinary[1].Name ~= "DataModel")
|
|
|
|
assert(savedXml[1].Name ~= "DataModel")
|
|
|
|
|
|
|
|
assert(savedBinary[1].ClassName == "Model")
|
|
|
|
assert(savedBinary[2].ClassName == "Part")
|
|
|
|
|
|
|
|
assert(savedXml[1].ClassName == "Model")
|
|
|
|
assert(savedXml[2].ClassName == "Part")
|