Jump to content




[SOLVED] what is wrong with this table?


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

#1 Creeper9207

  • Members
  • 211 posts

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 by Creeper9207, 01 November 2015 - 02:58 PM.


#2 MKlegoman357

  • Members
  • 1,170 posts
  • LocationKaunas, Lithuania

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";
}


#3 Anavrins

  • Members
  • 775 posts

Posted 01 November 2015 - 04:14 PM

Packets[5] has an error with the verificationkey, it says verificationk.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users