Hello. I have a table in file “Quest1”. How to insert variables into a group in the main scene?
this is my table
local vpr = {}
function vpr:vop()
vpr.tekst1 = display.newText( "8", display.contentCenterX - 10 , display.contentCenterY - 170, "MyriadPro-Regular.otf", 28 )
vpr.tekst1:setFillColor(230/255,230/255,230/255,1)
vpr.tekst2 = display.newText( "E", display.contentCenterX + 10 , display.contentCenterY - 170, "WebMobile-Regular.ttf", 56 )
vpr.tekst2:setFillColor(132/255,0/255,50/255,1)
vpr.tekst3 = display.newText( "-", display.contentCenterX - 30 , display.contentCenterY - 155, "MyriadPro-Regular.otf", 26 )
vpr.tekst3:setFillColor(230/255,230/255,230/255,1)
vpr.tekst4 = display.newText( "2", display.contentCenterX - 10 , display.contentCenterY - 140, "MyriadPro-Regular.otf", 28 )
vpr.tekst4:setFillColor(230/255,230/255,230/255,1)
vpr.tekst5 = display.newText( "2", display.contentCenterX + 10 , display.contentCenterY - 140, "MyriadPro-Regular.otf", 28 )
vpr.tekst5:setFillColor(230/255,230/255,230/255,1)
vpr.tekst6 = display.newText( "6", display.contentCenterX - 10 , display.contentCenterY - 100, "MyriadPro-Regular.otf", 28 )
vpr.tekst6:setFillColor(230/255,230/255,230/255,1)
vpr.tekst7 = display.newText( "3", display.contentCenterX + 10 , display.contentCenterY - 100, "MyriadPro-Regular.otf", 28 )
vpr.tekst7:setFillColor(230/255,230/255,230/255,1)
vpr.tekst8 = display.newText( "E", display.contentCenterX - 20 , display.contentCenterY - 20, "WebMobile-Regular.ttf", 56 )
vpr.tekst8:setFillColor(132/255,0/255,50/255,1)
vpr.tekst9 = display.newText( "= ?", display.contentCenterX + 20 , display.contentCenterY - 20, "MyriadPro-Regular.otf", 28 )
vpr.tekst9:setFillColor(230/255,230/255,230/255,1)
local vopros = display.newRoundedRect( display.contentCenterX , display.contentCenterY - 120 , 50, 1, 0 )
vopros.strokeWidth = 1/2
vopros:setFillColor( 230/255,230/255,230/255,1 )
vopros:setStrokeColor( 230/255,230/255,230/255,1 )
end
vpr.otvet = "5"
return vpr
how to loop through all table values and insert into sceneGroup
local vpr = require("Questions.Quest" .. settings.TL )
local sceneGroup = self.view
vpr:vop()
for i = 1 , #vpr do
sceneGroup:insert(vpr[i])
i = i + 1
end