

Learn will be false if there was space in front of the turtle at the start. I would scrap your detect function altogether, as it's making things more complex then they need to be.

Instead of going "if condition then variable = 1 end", you can simply type " variable = condition", and then later you can check what that result was by going "if variable then task end". You can also store booleans (true/false) values in tables. There's no point in a single-index table, there's no point in the string you may as well just store the number 1. Table.insert(moveHistory,, you're creating a new table with one single index which has the text (as opposed to the number) "1" stored in it as a string. Local timeSinceLastMove = os.clock() - lastMove the turtle should move along a path, and then move back along it, taking the exact amount of time in between movements That is because when you're inserting the table into t, you're actually inserting a table in a table.Īn untested example. So assuming you wanted to grab the third piece of information from the second table you would need to do this Tablename.Well the code you have there would create this structure If there is, I'd want to give table rows my own personal ID name that would be unique, like an ID on a webpage, that I could then use to refer to it. Is there any way to get the id by referring to one of the table rows variable values? I know you can assign an ID when you insert it, but I have had problems with this since it seems to hate it if you try to go out of order. But you can't always depend on this id being the same. Is there any way to refer to a Table row by one of its variables? Rather than just its ID which could change at any time.īasically when you insert into a Table, you're throwing stuff in there and the language takes care of assigning it an ID which can be referred to if you call tablename.whatever.
