local recipees = {}
function addRecipee(product, ingredients)
table.insert(recipees, product, ingredients)
end
Might want to check out how table.insert works again.
It has 3 possible arguments, but only 2 are required.
argument 1 is always the table that you want to insert into
argument 2 is either the thing you want to insert into the table, or the
numerical value that you want to insert the third argument as
argument 3 should only be there if you put a number as argument 2. This argument is what you want to insert into the table at the given value.
As for the question. From what I understand, you are wanting to know if the idea to have a computer running one program, and a turtle running another, where on the computer there is a gui, where you can insert new recipes, ask for a given recipe to be made, or sort/transport items, and the turtle will then go and do it. Simply put yes this is possible, however, if you do not have any coding experience I would suggest starting on something a little more basic.
Tables:
Tables are a incredibly powerful part of LUA. You can think of them as a variable with a lot of smaller variables inside of it, which are sorted by a key, value system. The key is the name of the variable inside of the table, and the value is just what the variable is equal to.
Example:
myTable = {}
myTable["this is a key"] = "this is a value" --# assigning the value "this is a value" to the key "this is a key"
print(myTable["this is a key"]) --# will print "this is a value"
Rednet:
So as TYKUHN2 said you can send tables in rednet, which makes it easy to transfer the information from the computer to the turtle. It is simply:
On the turtle:
rednet.open(side) --# side is the side the wireless modem is on, this only needs to be called once at the beginning of the program
id, message = rednet.receive() --# message will equal the first message the computer receives. It is generally good to check the id to make sure it is from the correct computer.
--# id is the computer id of the computer that sent the message
on the computer:
myTable = {}
--# put stuff in the table somewhere around here
rednet.send(id, myTable) --# sending the myTable table, to the computer with id "id", you would need to change the id variable here to the id of the turtle
Storing a table:
You change a table into text form by using textutils.serialize(tbl)
example:
myTable = {"hi", "bye", "another value"}
print(textutils.serialize(myTable)) --# will print a text form of the table
To save the table:
myTable = {"hi", "bye", "another value"}
h = fs.open("file","w") --# opening file "file" for writing "w"
h.write(textutils.serialize(myTable)) --# writing the table to the file
h.close() --# closing and saving the file
To access the saved file:
h = fs.open("file","r") --3 opening file "file" for reading "r"
contents = h.readAll() --# reading all of the contents of the file, and saving it to the a variable
h.close() --# closing the file
myTable = textutils.unserialize(contents) --# transforming the text back into a table