Hello
I have been recently trying to migrate from widget 1.0 to 2.0 slowly. The migration to widget 2.0 is a bit tedious. The problem is I have been getting this error
Error: bad argument #1 to ‘newText’ (string expected, got nil)
at this part of the code
local rowText = {"sky", "ground", "floor"} local function onRowRender( event ) local row = event.row local rowGroup = event.view local label = "List item " local color = 0 --Create the row's text local thisRowText if rowText[row.index] ~= nil then thisRowText = rowText[row.index] else thisRowText = "" end row.textObj = display.newText( rowGroup, thisRowText, 0, 0,native.systemFontBold, 20 ) --The error is directing here row.textObj:setTextColor( color ) row.textObj:setReferencePoint( display.CenterLeftReferencePoint ) row.textObj.x = 90 row.textObj.y = 40 rowGroup:insert( row.textObj ) --Create the row's arrow row.arrow = display.newImage( "rowArrow.png",false ) row.arrow.x = rowGroup.contentWidth - row.arrow.contentWidth \* 10 row.arrow.y = rowGroup.contentHeight \* 0.5 rowGroup:insert( row.arrow ) row.arrow2 = display.newImageRect( "blk"..row.index..".png",60,60) row.arrow2.x = 40 row.arrow2.y = rowGroup.contentHeight \* 0.5 rowGroup:insert( row.arrow2 ) end local function onRowTouch( event ) local row = event.row local background = event.background if event.phase == "press" then print( "Pressed row: " .. row.index ) background:setFillColor( 0, 110, 233, 255 ) elseif event.phase == "release" or event.phase == "tap" then director:changeScene("blk"..row.index) print( "Tapped and/or Released row: " .. row.index ) background:setFillColor( 0, 110, 233, 255 ) row.reRender = true end end -- insert rows into list (tableView widget) list = widget.newTableView { top = 32, width = 320, height = 400, hideBackground = true, maskFile = "mask-320x448.png", onRowRender = onRowRender, onRowTouch = onRowTouch, } --Insert widgets/images into a group widgetGroup:insert( list ) widgetGroup:insert( titleBar ) --widgetGroup:insert( back ) widgetGroup:insert( titleText ) for i = 1, 3 do list:insertRow { rowHeight = 80, rowColor = { default = { 255, 255, 255, 0 }, }, } end end
I have been trying to interpret what the the error is saying. What is it trying to say?