loading text from a string

If it try to load this code is shows  “q201”  and not the desired  “Display 2”  any thoughts on this ?

TestCount = 2 q101 = "Display 1" q201 = "Display 2" q1 = "q"..TestCount.."01" QD1 = display.newText("".. q1, 160, 20, MYRIADPRO, 30) QD1:setTextColor( 255, 255, 2552) QD1.x = display.contentWidth/2   QD1.y = display.contentHeight/2 screenGroup:insert(QD)

I believe it’s because your code is just showing the exact variables you’re inputting. So, you want it to show the string for “q1”, but your q1 variable is the letter q, followed by the TestCount variable which is 2, followed by the digits 0 and 1. 

You should read through the string API to determine which function would be best suited here.

http://docs.coronalabs.com/api/library/string/index.html

I had a look but still cant figure it out if i do :

q101 = "Display 1" q201 = "Display 2" q1 = q201 QD1 = display.newText("".. q1, 160, 20, MYRIADPRO, 30) QD1:setTextColor( 255, 255, 2552) QD1.x = display.contentWidth/2   QD1.y = display.contentHeight/2 screenGroup:insert(QD1)

it displays  “Display 2”  but i don’t get why    "    q1 = “q”…TestCount…“01”      " is not doing working as it is the same value 

TestCount = 3 q101 = "Display 1" q201 = "Display 2" q301 = "Display 3" q1 = ("q"..TestCount.."01") Q1 = display.newText(\_G[q1],  160, 20, MYRIADPRO, 30) Q1:setTextColor( 255, 255, 2552) Q1.x = display.contentWidth/2   Q1.y = display.contentHeight/2 screenGroup:insert(Q1)

I believe it’s because your code is just showing the exact variables you’re inputting. So, you want it to show the string for “q1”, but your q1 variable is the letter q, followed by the TestCount variable which is 2, followed by the digits 0 and 1. 

You should read through the string API to determine which function would be best suited here.

http://docs.coronalabs.com/api/library/string/index.html

I had a look but still cant figure it out if i do :

q101 = "Display 1" q201 = "Display 2" q1 = q201 QD1 = display.newText("".. q1, 160, 20, MYRIADPRO, 30) QD1:setTextColor( 255, 255, 2552) QD1.x = display.contentWidth/2   QD1.y = display.contentHeight/2 screenGroup:insert(QD1)

it displays  “Display 2”  but i don’t get why    "    q1 = “q”…TestCount…“01”      " is not doing working as it is the same value 

TestCount = 3 q101 = "Display 1" q201 = "Display 2" q301 = "Display 3" q1 = ("q"..TestCount.."01") Q1 = display.newText(\_G[q1],  160, 20, MYRIADPRO, 30) Q1:setTextColor( 255, 255, 2552) Q1.x = display.contentWidth/2   Q1.y = display.contentHeight/2 screenGroup:insert(Q1)