Posted 02 January 2014 - 12:01 PM
I used to use a for loop, where it would repeat the script in the loop by how many contents there are in the table, so a for loop that would repeat the script 3 times if the table had 3 variables. I'm sure it includes this text in the loop "in pairs". what is the script for it?
Also, I need a script that will check a tables contents in order until it finds it's first variable that doesn't exist, so an example table has three variables, and this script will check the table for the first variable that is nil and give the number of the variable in order from the start of the table and print it out, which will be 4 in this case, because the fourth variable is the first that doesn't exist. So a script that finds the first missing variable and prints it's number on your screen, script example.
Also, I need a script that will check a tables contents in order until it finds it's first variable that doesn't exist, so an example table has three variables, and this script will check the table for the first variable that is nil and give the number of the variable in order from the start of the table and print it out, which will be 4 in this case, because the fourth variable is the first that doesn't exist. So a script that finds the first missing variable and prints it's number on your screen, script example.
table = {}
table[1] = "test"
table[2] = "bananas"
table[3] = 47
table[4] = true
table[5] = false
table[6] = "sky"
table[7] = 3
--SCRIPT
variable = 8
--Because 8 is the very first missing variable
--HOW DO I DO THIS? WHAT WILL BE THE "SCRIPT"?
And what will be the script for that.Edited on 02 January 2014 - 11:17 AM