Jump to content




Expected number


  • You cannot reply to this topic
2 replies to this topic

#1 Inumel

  • Members
  • 120 posts

Posted 11 May 2013 - 01:53 AM

Hi! me again :)

I am trying to make a program that outputs a word of the users choice, in whatever color they want

Here is my code

word = ""
print("What word do you want to display?")
word = read()
print("What color do you want the text to be?")
color = read()
term.setTextColor("colors." .. color)
print(word)

i am getting the error Expected number when attempting to term.setTextColor

The way I wrote that, it should work i would think?

#2 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 11 May 2013 - 02:09 AM

For the colors part; you cannot use a string. You should use colors['blue'] for example

#3 Mads

  • Members
  • 604 posts
  • LocationCopenhagen, Denmark

Posted 11 May 2013 - 02:38 AM

Or you could use this(not best solution):
term.setTextColor(loadstring("return colors." .. color)())






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users