What is the term.serialize() and term.unserialize() good for and what do they do?
term.serialize() and term.unserialize()
Started by cptdeath58, May 28 2014 11:36 PM
5 replies to this topic
#1
Posted 28 May 2014 - 11:36 PM
#2
Posted 28 May 2014 - 11:43 PM
term.serialize, is that a 1.6 thing i didn't catch, or do you mean textutils.serialize?
textutils.serialize is used to convert a table to a string, unserialize converts it back.
textutils.serialize is used to convert a table to a string, unserialize converts it back.
Edited by CometWolf, 28 May 2014 - 11:43 PM.
#3
Posted 28 May 2014 - 11:43 PM
Where are you seeing term.serialize? I only know of textutils.serialize and textutils.unserialize, which are used for turning a table in a string representing the table and vice-versa.
#4
Posted 28 May 2014 - 11:44 PM
lol my bad textutils.serialize()
[EDIT] Im used to term than textutils
[EDIT] Im used to term than textutils
Edited by cptdeath58, 28 May 2014 - 11:45 PM.
#5
Posted 29 May 2014 - 06:11 PM
textutils.serialize converts a table into a string
It's good when saving a table to a file
it's good when loading a serialized table from a file or getting a serialized table over rednet
It's good when saving a table to a file
local t = { foo = "bar" }
local f = fs.open( "foo-bar", "w" )
f.writeLine( textutils.serialize( t ) )
f.close()
or sending it over rednetlocal t = { foo = "bar" }
rednet.send( 101, textutils.serialize( t )
textutils.unserialize converts it backit's good when loading a serialized table from a file or getting a serialized table over rednet
local f = fs.open( "foo-bar", "r" ) local t = textutils.unserialize( f.readAll() ) f.close()
local id, msg = rednet.receive() local t = textutils.unserialize( msg )
#6
Posted 02 June 2014 - 10:08 PM
Thanks, That helps a lot.
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











