Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local testState = {
- someData = "This is a test",
- moreData = 1234
- }
- -- Open a file to write the serialized data
- local file = fs.open("stateFile", "w")
- if file then
- -- Serialize the table
- local serializedData = textutils.serialize(testState)
- -- Check if serialization succeeded
- if serializedData then
- print("Serialized data:")
- print(serializedData) -- Output the serialized data for debugging
- -- Write the serialized data to the file
- file.write(serializedData)
- print("Data written to file.")
- else
- print("Serialization failed.")
- end
- -- Close the file
- file.close()
- else
- print("Failed to open file for writing.")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement