This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
simme2asum's profile picture

textutils.serialize/unserialize crashes edit

Started by simme2asum, 16 March 2014 - 10:59 AM
simme2asum #1
Posted 16 March 2014 - 11:59 AM
Hi guys, I got a small problem that bother me very much, every time i use textutils.serialize or textutils.unserialize in my programs my computer begins to act strange.

Here is an example code: (program name send)


Spoilerlocal modemSide = "top"
rednet.open(modemSide)
local receiverID = 4
t = {}
for i=1,15 do
t = "hello world"
end
table = textutils.serialize(t)
rednet.send(4, table)




The program work just fine but when i execute it but when i do: "edit send" i get this error: edit:53: attempt to call nil.
I'm beginning to suspect a minor error :/

Would really appriciate some help on this one :)/>
Lyqyd #2
Posted 16 March 2014 - 08:38 PM
It's not that you are using the textutils functions, it is the fact that you are putting the return value from that function into the global table variable. In so doing, you are overriding the table library (table.insert, table.remove, etc.), so when another program tries to use that library, the functions won't be there. Put the results in a different variable instead, or at the very least, make it local.