7 posts
Posted 07 January 2013 - 06:07 PM
Hi there. I'm fairly new to computercraft/lua/programming, but learning fast. One thing I'm wondering about is, is there a way to write out a set of instructions (eg for a mining turtle) and somehow save them and reuse them throughout a lua program without needing to retype everything? This is in a case where looping is not applicable. Thank for the help.
8543 posts
Posted 07 January 2013 - 06:22 PM
Are you looking for functions?
function doStuff()
turtle.up()
turtle.forward()
turtle.down()
turtle.back()
end
doStuff()
--later
doStuff()
7 posts
Location
UK
Posted 08 January 2013 - 05:30 AM
By 'set of instructions' I assume you mean programs?
You can save your programs to disks, so you can reuse them when you break your turtle, or on another turtle. You'll need a
disk drive and a
floppy disk. There's a forum thread
here on saving programs to a floppy disk.