Jump to content




term.serialize() and term.unserialize()


  • You cannot reply to this topic
5 replies to this topic

#1 cptdeath58

  • Members
  • 139 posts
  • LocationError 404: Could not find.

Posted 28 May 2014 - 11:36 PM

What is the term.serialize() and term.unserialize() good for and what do they do?

#2 CometWolf

  • Members
  • 1,283 posts

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.

Edited by CometWolf, 28 May 2014 - 11:43 PM.


#3 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

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 cptdeath58

  • Members
  • 139 posts
  • LocationError 404: Could not find.

Posted 28 May 2014 - 11:44 PM

lol my bad textutils.serialize()

[EDIT] Im used to term than textutils

Edited by cptdeath58, 28 May 2014 - 11:45 PM.


#5 TheOddByte

    Lazy Coder

  • Members
  • 1,607 posts
  • LocationSweden

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
local t = { foo = "bar" }
local f = fs.open( "foo-bar", "w" )
f.writeLine( textutils.serialize( t ) )
f.close()
or sending it over rednet
local t = { foo = "bar" }
rednet.send( 101, textutils.serialize( t )
textutils.unserialize converts it back
it'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 cptdeath58

  • Members
  • 139 posts
  • LocationError 404: Could not find.

Posted 02 June 2014 - 10:08 PM

Thanks, That helps a lot.





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users