Posted 11 August 2016 - 03:30 PM
Im currently trying to understand Tables work on my own but I cant figure out how to use them. :D/>
Ive just wrote a simple adder to test it out
So basically I want it to take a look at the digits in the table and if its one of them it should print out the options again
but currently its doing nothing at all. :P/>
Tables are used to shorten Code as far as I understood, but how do I use it?
What part of tables did I missunderstand or is my thought of what it is and what its used for completly wrong?
Ive just wrote a simple adder to test it out
sum = 0
print("Press 'E' to add a digit, 'X' to exit!")
print("Current count: "..sum)
local Table = {10,20,30,40,50} [color=#008000]--- The Table with the list of digits I want to use [/color]
local function Blue()
term.setTextColor( colors.blue )
end
local function White()
term.setTextColor( colors.white )
end
while true do
loca event, key = os.pullEvent("key")
if key == keys.e then
sum = sum + 1
print("Current count: "..sum)
elseif key == keys.x then
break
end
if sum == Table then [color=#008000] --- This where I need help[/color]
Blue()
print("---- E to add, X to exit! ---")
end
end
So basically I want it to take a look at the digits in the table and if its one of them it should print out the options again
but currently its doing nothing at all. :P/>
Tables are used to shorten Code as far as I understood, but how do I use it?
What part of tables did I missunderstand or is my thought of what it is and what its used for completly wrong?
Edited on 11 August 2016 - 01:31 PM