Hello, I am currently creating and app that will create a table, number it 1-100 and then place a random character next to each number. It should look something like this

As for now here is my code. It will work but I am basically just doing the same process over and over.
module(..., package.seeall)
function new()
local localGroup = display.newGroup()
local random = math.random
--\> This is how we start every single file or "screen" in our folder, except for main.lua
-- and director.lua
--\> director.lua is NEVER modified, while only one line in main.lua changes, described in that file
------------------------------------------------------------------------------
------------------------------------------------------------------------------
local background = display.newImage ("blackbackground.png")
localGroup:insert(background)
--\> This sets the background
local textfield = display.newText("", 25, 125, native.systemFontBold, 14)
localGroup:insert(textfield)
local textfield1 = display.newText("", 50, 125, native.systemFontBold, 14)
localGroup:insert(textfield1)
local textfield2 = display.newText("", 75, 125, native.systemFontBold, 14)
localGroup:insert(textfield2)
local textfield3 = display.newText("", 100, 125, native.systemFontBold, 14)
localGroup:insert(textfield3)
local textfield4 = display.newText("", 125, 125, native.systemFontBold, 14)
localGroup:insert(textfield4)
local textfield5 = display.newText("", 150, 125, native.systemFontBold, 14)
localGroup:insert(textfield5)
local textfield6 = display.newText("", 175, 125, native.systemFontBold, 14)
localGroup:insert(textfield6)
local textfield7 = display.newText("", 200, 125, native.systemFontBold, 14)
localGroup:insert(textfield7)
local textfield8 = display.newText("", 225, 125, native.systemFontBold, 14)
localGroup:insert(textfield8)
local textfield9 = display.newText("", 250, 125, native.systemFontBold, 14)
localGroup:insert(textfield9)
local textfield10 = display.newText("", 275, 125, native.systemFontBold, 14)
localGroup:insert(textfield10)
local textfield11 = display.newText("", 25, 150, native.systemFontBold, 14)
localGroup:insert(textfield11)
local textfield12 = display.newText("", 50, 150, native.systemFontBold, 14)
localGroup:insert(textfield12)
local textfield13 = display.newText("", 75, 150, native.systemFontBold, 14)
localGroup:insert(textfield13)
local textfield14 = display.newText("", 100, 150, native.systemFontBold, 14)
localGroup:insert(textfield14)
local textfield15 = display.newText("", 125, 150, native.systemFontBold, 14)
localGroup:insert(textfield15)
local textfield16 = display.newText("", 150, 150, native.systemFontBold, 14)
localGroup:insert(textfield16)
local textfield17 = display.newText("", 175, 150, native.systemFontBold, 14)
localGroup:insert(textfield17)
local textfield18 = display.newText("", 200, 150, native.systemFontBold, 14)
localGroup:insert(textfield18)
local textfield19 = display.newText("", 225, 150, native.systemFontBold, 14)
localGroup:insert(textfield19)
local textfield20 = display.newText("", 250, 150, native.systemFontBold, 14)
localGroup:insert(textfield20)
local textfield21 = display.newText("", 275, 150, native.systemFontBold, 14)
localGroup:insert(textfield21)
local myArray = {}local options = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L","M", "N", "O" , "P", "Q", "R", "S", "T", "U",
"V", "W","X","Y","Z","œ", "©", "¡", "®", "¾", "Â", "µ", "Á", "¥", "‡", "ß" }
local backbutton = display.newImage ("return.png")
backbutton.x = 160
backbutton.y = 350
localGroup:insert(backbutton)
--\> This places our "back" button
local ranbutton = display.newImage ("random.png")
ranbutton.x = 160
ranbutton.y = 100
localGroup:insert(ranbutton)
--\> this adds our random button
local function ranChoose(event)
if "ended" == event.phase then
textfield.text = options[math.random(1, 37)]
end
end
local function ranChoose1(event)
if "ended" == event.phase then
textfield1.text = options[math.random(1, 37)]
end
end
local function ranChoose2(event)
if "ended" == event.phase then
textfield2.text = options[math.random(1, 37)]
end
end
local function ranChoose3(event)
if "ended" == event.phase then
textfield3.text = options[math.random(1, 37)]
end
end
local function ranChoose4(event)
if "ended" == event.phase then
textfield4.text = options[math.random(1, 37)]
end
end
local function ranChoose5(event)
if "ended" == event.phase then
textfield5.text = options[math.random(1, 37)]
end
end
local function ranChoose6(event)
if "ended" == event.phase then
textfield6.text = options[math.random(1, 37)]
end
end
local function ranChoose7(event)
if "ended" == event.phase then
textfield7.text = options[math.random(1, 37)]
end
end
local function ranChoose8(event)
if "ended" == event.phase then
textfield8.text = options[math.random(1, 37)]
end
end
local function ranChoose9(event)
if "ended" == event.phase then
textfield9.text = options[math.random(1, 37)]
end
end
local function ranChoose10(event)
if "ended" == event.phase then
textfield10.text = options[math.random(1, 37)]
end
end
local function ranChoose11(event)
if "ended" == event.phase then
textfield11.text = options[math.random(1, 37)]
end
end
local function ranChoose12(event)
if "ended" == event.phase then
textfield12.text = options[math.random(1, 37)]
end
end
local function ranChoose13(event)
if "ended" == event.phase then
textfield13.text = options[math.random(1, 37)]
end
end
local function ranChoose14(event)
if "ended" == event.phase then
textfield14.text = options[math.random(1, 37)]
end
end
local function ranChoose15(event)
if "ended" == event.phase then
textfield15.text = options[math.random(1, 37)]
end
end
local function ranChoose16(event)
if "ended" == event.phase then
textfield16.text = options[math.random(1, 37)]
end
end
local function ranChoose17(event)
if "ended" == event.phase then
textfield17.text = options[math.random(1, 37)]
end
end
local function ranChoose18(event)
if "ended" == event.phase then
textfield18.text = options[math.random(1, 37)]
end
end
local function ranChoose19(event)
if "ended" == event.phase then
textfield19.text = options[math.random(1, 37)]
end
end
local function ranChoose20(event)
if "ended" == event.phase then
textfield20.text = options[math.random(1, 37)]
end
end
local function ranChoose21(event)
if "ended" == event.phase then
textfield21.text = options[math.random(1, 37)]
end
end
ranbutton:addEventListener("touch", ranChoose)
ranbutton:addEventListener("touch", ranChoose1)
ranbutton:addEventListener("touch", ranChoose2)
ranbutton:addEventListener("touch", ranChoose3)
ranbutton:addEventListener("touch", ranChoose4)
ranbutton:addEventListener("touch", ranChoose5)
ranbutton:addEventListener("touch", ranChoose6)
ranbutton:addEventListener("touch", ranChoose7)
ranbutton:addEventListener("touch", ranChoose8)
ranbutton:addEventListener("touch", ranChoose9)
ranbutton:addEventListener("touch", ranChoose10)
ranbutton:addEventListener("touch", ranChoose11)
ranbutton:addEventListener("touch", ranChoose12)
ranbutton:addEventListener("touch", ranChoose13)
ranbutton:addEventListener("touch", ranChoose14)
ranbutton:addEventListener("touch", ranChoose15)
ranbutton:addEventListener("touch", ranChoose16)
ranbutton:addEventListener("touch", ranChoose17)
ranbutton:addEventListener("touch", ranChoose18)
ranbutton:addEventListener("touch", ranChoose19)
ranbutton:addEventListener("touch", ranChoose20)
ranbutton:addEventListener("touch", ranChoose21)
local function pressBack (event)
if event.phase == "ended" then
director:changeScene ("menu")
end
end
backbutton:addEventListener ("touch", pressBack)
--\> This adds the function and listener to the "back" button
------------------------------------------------------------------------------
------------------------------------------------------------------------------
return localGroup
end
--\>
as you can see the code is very, very redundant. There must be some way to mach the function loop. Any advice would be helpful. Thankyou in advance [import]uid: 10724 topic_id: 19609 reply_id: 319609[/import]
[import]uid: 12482 topic_id: 19609 reply_id: 75752[/import]