7 posts
Location
US
Posted 18 May 2016 - 01:17 AM
This is my first 'complex' program I have ever made . I am new to programming and Computer craft so I wanted to get constrictive criticism on how to make my program better. I also would like to hear comments if people want things added or changed.
Spoiler
http://pastebin.com/wiPKqNFQ
3057 posts
Location
United States of America
Posted 18 May 2016 - 01:59 AM
1. I would localize your variables
2. Avoid rebooting as much as possible (use a while loop instead)
3. Instead of creating separate functions for different colors, make a single function with an argument
23 posts
Location
USA
Posted 18 May 2016 - 05:11 AM
I didn't thoroughly go through the program but the "color()" functions could be summed up to:
local function change_color(rColor)
if term.isColor() then --You also don't need to put "== true" if it's true
term.setTextColor(colors[rColor]) -- You can do colors[color] and it is the same as colors.color. This allows using a variable as the color possible.
end
end
change_color("red") --Then you can call it like so
Instead of making a separate function for every color
Edited by