function scene:create( event ) local sceneGroup = self.view local path = system.pathForFile("database.sqlite", system.ResourceDirectory) db = sqlite3.open(path) -- -- width and height screen size -- local w = display.contentWidth local h = display.contentHeight local sql = "SELECT field FROM table WHERE id=3" --where i will get only one row for row in db:nrows(sql) do text = row.descricao end -- Now instead of using the next variable to show text, i want to use the variable above called text, to show the text that was queried local myText = [[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque semper mollis erat a. Praesent sit amet lorem nisl. Pellentesque interdum felis quis vehicula vestibulum. Donec ut dolor tortor.]] local paragraphs = {} local paragraph local tmpString = myText local scrollView = widget.newScrollView { top = 0, left = 0, width = display.contentWidth, height = display.contentHeight \* 0.83, bottomPadding = 0, scrollWidth = display.contentWidth, horizontalScrollDisabled = true, scrollHeight = 10000 } local options = { text = "", width = 300, font = "HelveticaNeue", fontSize = 14, align = "left" } local yOffset = 20 repeat paragraph, tmpString = string.match( tmpString, "([^\n]\*)\n(.\*)" ) options.text = paragraph paragraphs[#paragraphs+1] = display.newText( options ) paragraphs[#paragraphs].anchorX = 0 paragraphs[#paragraphs].anchorY = 0.055 paragraphs[#paragraphs].x = 10 paragraphs[#paragraphs].y = yOffset paragraphs[#paragraphs]:setFillColor( 0 ) scrollView:insert( paragraphs[#paragraphs] ) yOffset = yOffset + paragraphs[#paragraphs].height until tmpString == nil or string.len( tmpString ) == 0 sceneGroup:insert(scrollView) end
here is a very simple example of part of my code, inside of the code i am saying what i am trying to do.
i cannot simple use the variable text to show the text.
Thanks for the help