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

[SOLVED] what is wrong with this table?

Started by Creeper9207, 01 November 2015 - 01:52 PM
Creeper9207 #1
Posted 01 November 2015 - 02:52 PM

{
  packets = {
	1 = {
	  packet = "8",
	  verificationkey = "20621"
	},
	2 = {
	  packet = "8",
	  verificationkey = "10782"
	},
	3 = {
	  packet = "8",
	  verificationkey = "31413"
	},
	4 = {
	  packet = "8",
	  verificationkey = "48201"
	},
	5 = {
	  packet = "8",
	  verificationk
	6 = {
	  packet = "8",
	  verificationkey = "45631"
	},
	7 = {
	  packet = "8",
	  verificationkey = "15325"
	},
	8 = {
	  packet = "8",
	  verificationkey = "36076"
	},
	9 = {
	  packet = "8",
	  verificationkey = "45330"
	},
	10 = {
	  packet = "8",
	  verificationkey = "44792"
	},
	11 = {
	  packet = "8",
	  verificationkey = "31803"
	},
	12 = {
	  packet = "8",
	  verificationkey = "31563"
	},
	13 = {
	  packet = "8",
	  verificationkey = "48835"
	},
	14 = {
	  packet = "8",
	  verificationkey = "46391"
	},
	15 = {
	  packet = "9",
	  verificationkey = "49580"
	},
	16 = {
	  packet = "9",
	  verificationkey = "35297"
	},
	17 = {
	  packet = "9",
	  verificationkey = "40632"
	},
	18 = {
	  packet = "9",
	  verificationkey = "31862"
	},
	19 = {
	  packet = "9",
	  verificationkey = "33537"
	},
	20 = {
	  packet = "9",
	  verificationkey = "11523"
	}
  }
}
when i run this through textutils unserialize and serialize it comes out nil, whats wrong with the formatting?
Edited on 01 November 2015 - 01:58 PM
MKlegoman357 #2
Posted 01 November 2015 - 03:00 PM
Every key that isn't a valid identifier must be enclosed in the [] brackets:


local t = {
  [1] = "one";
  [2] = "two";
}

But you don't really need to do the numeration manually, Lua will do it automatically (starting from the number 1):


local t = {
  "one";
  "two";
}
Anavrins #3
Posted 01 November 2015 - 04:14 PM
Packets[5] has an error with the verificationkey, it says verificationk.