This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
RicardoRedstone's profile picture

Need Help With Code That Doesn't Work

Started by RicardoRedstone, 04 October 2013 - 10:19 AM
RicardoRedstone #1
Posted 04 October 2013 - 12:19 PM
i'm making a program that lets you choose an option using arrow keys, but the function to print the "output" is not working
the code is this:

function draw(selected,options,simbols)
--creates the "draw" function
for i = 1, #options do
--runs the loop that prints the text
  if i == selected then
  --checks if the current option is the same number as the "selected" argument
   print=(simbols[2].." "..options[i])
   --if yes is, it prints the second simbol followed by the option
  else
   print=(simbols[1].." "..options[i])
   --if not, it prints the first simbol followed by the option
  end
end
end
draw(3,{"opt1","opt2","opt3"},{"-","+"})
--uses the "draw" function built earlier
it runs without errors, but it doesn't print anything. i have no clue on what it wrong with it, could anyone help?
Zudo #2
Posted 04 October 2013 - 12:37 PM
   print=(simbols[1].." "..options[i])

You don't need the = sign.

(Symbols is spelled like that)
RicardoRedstone #3
Posted 04 October 2013 - 06:42 PM
wow, i don't believe I could forget that…
Zudo #4
Posted 05 October 2013 - 04:39 AM
I assume that nothing worked after running the buggy program? Because you redefined print() :D/>