composer passing parameters?

hi, thanks for supporting corona SDK and this forum, I’ve solved a lot of my problems on corona SDK, myself, being new to corona…

I’ve been hacking this out for about 2hrs now so since it’s a very specific question, about passing params in composer from scene to scene…

I’m getting the text param, not the number and I can’t covert the number to a string because it’s in a table. (there’s probably a scope issue in here somewhere)

I tried passing event.row, event.params.row, setting rowIdx = event.row, rowIdx = tostring(event.row) and even that comes out as a table in tostring()…what gives???

thanks,

daveC

in my current scene, a table, I’m trying to pass the row of the table that is selected by touch, I only need the row. event.row prints, to the console, a number when in this function. I tried reading the docs, stackoverflow, google corona passing parameters with composer, etc…

 

below is the code from scene4 and we’re going to scene5, took a lot of ingenuity to come up with those names!?!?!

 

[lua]

local function onRowTouch( event )

– pass the row to access in the next scene too!

local row = event.row – Get reference to the row group –< it is definitely set, I think here

print("-----onRowTouch------- row.index is " … tostring(row.index))

print("-----onRowTouch------- event.target is " … tostring(event.target))

– store the record number in a file and goto the edit scene

local selectedRow = event.row.value

local options = 

{

time = 1000,

params = {

row = tostring(selectedRow),   –< tried row = event.row.value, event.row, setting it to a local var. ugh…

howdy = “hello” … tostring(selectedRow)

}

}

composer.gotoScene( “view5”, options)   - –< goto next scene passing params

end

– The “onRowRender” function may go here (see example under “Inserting Rows”, above)

local function onRowRender( event )

    --local phase = event.phase – I don’t know what is this for

    local row = event.row – Get reference to the row group

    

        local nameOfSongs

        if myData[row.index] ~= nil then

          nameOfSongs = myData[row.index]

        else

          nameOfSongs = “MT”

        end

        

    – Cache the row “contentWidth” and “contentHeight” because the row bounds can change as children objects are added

    local rowHeight = row.contentHeight

    local rowWidth = row.contentWidth

    --local songName = display.newText( row, nameOfSongs, 0, 0, native.systemFont, 12)  or not found DroidSansMono

local songName = display.newText( row, myData[row.index].name, 0, 0, native.systemFont, 12)  

    songName.anchorX = 0

    songName.x = 20

    songName.y = rowHeight * 0.5

    songName:setTextColor( 0, .12, .98 )

–[[

myData[row.index].phone

–]]

local songName = display.newText( row, “Robinson” , 0, 0, native.systemFont, 12)  

    songName.anchorX = 0

    songName.x = 75

    songName.y = rowHeight * 0.5

    songName:setTextColor( 0, .12, .98 )

local songName = display.newText( row, myData[row.index].relationship, 0, 0, native.systemFont, 12)  

    songName.anchorX = 0

    songName.x = 150

    songName.y = rowHeight * 0.5

    songName:setTextColor( 0, .12, .98 )

local songName = display.newText( row, myData[row.index].hotFlag, 0, 0, native.systemFont, 12)  

    songName.anchorX = 0

    songName.x = 170

    songName.y = rowHeight * 0.5

    songName:setTextColor( 0, .12, .98 )

local songName = display.newText( row, myData[row.index].lflag, 0, 0, native.systemFont, 12)  

    songName.anchorX = 0

    songName.x = 180

    songName.y = rowHeight * 0.5

    songName:setTextColor( 0, .12, .98 )

local songName = display.newText( row, “$” … myData[row.index].cashAvail, 0, 0, native.systemFont, 12)  

    songName.anchorX = 0

    songName.x = 195

    songName.y = rowHeight * 0.5

    songName:setTextColor( 0, .12, .98 )

local songName = display.newText( row, myData[row.index].experience, 0, 0, native.systemFont, 12)  

    songName.anchorX = 0

    songName.x = 245

    songName.y = rowHeight * 0.5

    songName:setTextColor( 0, .12, .98 )

local songName = display.newText( row, myData[row.index].counties, 0, 0, native.systemFont, 12)  

    songName.anchorX = 0

    songName.x = 275

    songName.y = rowHeight * 0.5

    songName:setTextColor( 0, .12, .98 )

local songName = display.newText( row, myData[row.index].bio, 0, 0, native.systemFont, 12)  

    songName.anchorX = 0

    songName.x = 345

    songName.y = rowHeight * 0.5

    songName:setTextColor( 0, .12, .98 )

–print("------onRowRender songList[row.index] is " … tostring(songList[row.index] ))

print("------onRowRender myData[row.index] is " … myData[row.index].name … " - " … myData[row.index].phone)

end

[/lua]

 

here is the console output used to see what the heck I’m missing

 

[lua]

02:22:25.200  Scroll view was touched

02:22:25.200  (46)-----onRowTouch------- event.target is table: 05A1C208

02:22:25.310  -----onRowTouch------- row.index is 5       –< so it is set in scene4

02:22:25.310  -----onRowTouch------- event.target is table: 05A1C208   –< scene4 ending

02:22:25.310  5a-------------------------< view5 start >----------------------

02:22:25.310  5C------< passed in params of nil

02:22:25.310  5C------< passed in params of hellonil   –< hello, the text comes in but not the integer or tostring(integer)

02:22:25.310  5C------ rowIdx is nil

02:22:25.310  5C------(36) params.row is nil

02:22:25.310  5S-------------------------< view5 scene show start >----------------------

02:22:25.310  5S— (50) params passed in?

02:22:25.310  5S(55)------< scene:show phase is will >--------------    

02:22:25.310  5S(56)------< passed in params of nil

02:22:25.310  5S(61)------< scene:show >--------------    

02:22:25.310  5S(65)------< scene:show will start >--------------    

02:22:25.310  5S(85)------< scene:show will display labels and input fields >--------------    

02:22:25.515  5S(238)------< scene:show end >--------------    

02:22:25.515  5S-------------------------< view5 scene show start >----------------------

02:22:25.515  5S— (50) params passed in?

02:22:25.515  5S(55)------< scene:show phase is did >--------------    

02:22:25.515  5S(56)------< passed in params of nil

02:22:25.515  5S(61)------< scene:show >--------------    

02:22:25.515  5S(235)------< scene:show did start >--------------    

02:22:25.515  5S(238)------< scene:show end >--------------    

02:22:25.515  (33)---------scrollListener event.row is nil

02:22:25.515  Scroll view was released

02:22:25.515  (46)-----onRowTouch------- event.target is table: 05A1C208

02:22:25.515  -----onRowTouch------- row.index is 5

02:22:25.515  -----onRowTouch------- event.target is table: 05A1C208

02:22:25.515  5-------------------< view5 scene:hide start >------------------------------

02:22:25.515  5-------------------< view5 scene:hide will >------------------------------

02:22:25.515  5-------------------< view5 scene:hide end >------------------------------

02:22:25.706  5-------------------< view5 scene:hide start >------------------------------

02:22:25.706  5-------------------< view5 scene:hide did >------------------------------

02:22:25.706  5-------------------< view5 scene:hide end >------------------------------

02:22:25.769  5S-------------------------< view5 scene show start >----------------------

[/lua]

 

here is the output from the console… I get nil or ‘event.target is table: 09DD34A0’ on the numeric value even when I use tostring, the damn ‘hello’ goes through w/o a hitch and I don’t even need that. just used it to see if it actually passed anything.

 

I was a little unclear as to what you were specifically having an issue with. The topic indicates passing composer parameters, but the description indicates you can’t get the row you selected. This will hopefully answer the row question and let you move forward.

I think what you might be looking for is this… You either want the event.target or the event.target.index depending on your needs.

onRowTouch (optional)

Listener. The function used to listen for TableViewWidget touch/tap events. In this listener function, the event.phase values include “tap”, “press”, “release”, “swipeLeft”, and “swipeRight”. In addition, event.target is a reference to the row that was interacted with and event.target.index is the index number of that row

 

https://docs.coronalabs.com/api/library/widget/newTableView.html#onrowtouch-optional

In your onRowRender() function you never set a row.value value so when onRowTouch happens and this line executes:

local selectedRow = event.row.value

event.row.value is nil.

Somewhere in onRowRender you need to do a:

row.value = somevalue

Rob

rob, graham07,

thanks for your reply. that did help solve the the problem and I found the root problem which actual was/is… I don’t understand the object event details. upon further research, it is unclear from:

     https://docs.coronalabs.com/api/event/touch/index.html

that event.target.index, event.target.row.value,  or event.target.row exist or not as a component of the object event or event.target. as an example, from the doc page on widgets:

widget.newTableView( options )

options are clearly defined so it’s easy to figure out how to use them. but on events/touch… there is no mention of *.index, *.row, *.value, *.text so I didn’t know how to reference the row touched past the variable event.row in onRenderRow( event )

is there somewhere (i.e. a webpage or docs) I can research the actual object details for events and other objects other than looking through the source code?

thanks again for your support of the forum and corona.

daveC

For the functions that handle onRowRender() and onRowTouch(), there will be an “event” table that will have various members. One of those is:

event.row

This is the display group that holds the row’s display objects. But it’s a Lua table which means you can add your own key/value pairs to it.

Many people not only add the display objects to the group but also store the pointer to the object as well. This way when you’re in your onRowTouch function you can have an easy reference to the objects that make up the row. 

The documentation you pointed to is for touch events which has an event.target member. The widget.newTableView() manages your touch events for you. And that event has different members to the event table.

Rob

ok, onto the next step…

scope, smope. I contend that corona has no concept of scope cause I’m old school, that is not scope as I know it from any other language… if you set a variable in a block, it should be set in the entire block. I read the lua docs (3.5 – Visibility Rules), x = x but oh, x doesn’t equal x,  the right side x is an old x, (which persists) and the left side x is a new x… not confusing at all, haha.

so I have a similar issues with the below code where I’ve got the params coming in from a scene transition, rowString, rowNumber (just to be sure used number and string vars), a table, (now I’m adventurous), and they all pass from scene4 to scene5 nicely. I can see the references to each param and table contiguous as the program proceeds. line (33) table is referenced as table: 06B37590 which continues throughout, the rowNumber and rowString (being passed both as a number and a string) also continues throughout. 

so the question I have is, if I assign i = 5 and print myData[5].name I get ‘pebbles’ in multiple places, lines 40, 76 but if I reference myData[row].name, myData[rowNumber].name, myData[params.rowNumber].name, or myData[event.params.rowNumber].name I get an error, the damn ‘nil’ issue…

what am I missing on the scope issues of lua???

thanks,

daveC

[lua]

function scene:show( event )

local sceneGroup = self.view

print(“5c-------------------------< view5 scene:show start >----------------------”)

local params = event.params

if (params) then

passedTxt = event.params.howdy

passedRowString = event.params.rowString

passedRowNumber = event.params.rowNumber

myData = event.params.table

row = event.params.rowNumber

print("5C------ params.rowNumber is " … tostring(params.rowNumber))

print("5C------ params.rowString is " … params.rowString)

print("5C–(73)---- params.howdy is " … params.howdy)

local i = 5

print(“5C–(76)---- row in table myData[” … i … "].fname is " … myData[i].name)

print("5C------ table reference for myData is " … tostring(myData))

else

print("5C------  no params???    ")

end

print("5S------(82)— row is " … row )

print("5S------(83)— event.phase is " … event.phase)

—================================================================

print("5S------(87)— event.params.rowNumber is " … event.params.rowNumber )

print("5S------(88)— params.rowNumber is " … params.rowNumber )

–print("5S------(89)— rowNumber is " … rowNumber )

print("5S------(90)— row is " … row )

print("5S------(91)— myData is " … tostring(myData))

print("5S------(92)-------- myData[row].name is " … myData[row].name)

print("5S------(93)-------- myData[params.rowNumber].name is " … myData[params.rowNumber].name)

**********************************************

**********************************************

13:42:39.860  Scroll view was touched

13:42:39.860  (46)-----onRowTouch------- event.target is table: 06BD0E50

13:42:39.970  4--------onRowTouch------- event.target is table: 06BD0E50

13:42:39.970  4--------onRowTouch------- event.target.index is 7

13:42:39.970  4--------onRowTouch------- event.row is table: 06BD0E50

13:42:39.970  4--------onRowTouch------- tostring(row) is 7

scene4 above

13:42:39.970  5a-------------------------< view5 start >----------------------

13:42:39.970  5b-------------------------< view5 scene:create start >----------------------

13:42:39.970  5C–(33)----< assigned myData table of table: 06B37590

13:42:39.970  5C------< passed in table of table: 06B37590

13:42:39.970  5C------ params.rowNumber is (7)

13:42:39.970  5C------ params.rowString is (7)

13:42:39.970  5C—(37)— params.howdy is hello7

13:42:39.970  5C–(40)---- row in table myData[5].fname is Pebbles

13:42:39.970  5C------ table reference for myData is table: 06B37590

13:42:39.970  5C------(43) params.rowNumber is nil

13:42:39.970  5C------(44)passedRowNumberis (7)

13:42:39.970  5c-------------------------< view5 scene:show start >----------------------

13:42:39.970  5C------ params.rowNumber is (7)

13:42:39.970  5C------ params.rowString is (7)

13:42:39.970  5C–(73)---- params.howdy is hello7

13:42:39.970  5C–(76)---- row in table myData[5].fname is Pebbles

13:42:39.970  5C------ table reference for myData is table: 06B37590

13:42:39.970  5S------(82)— row is (7)

13:42:39.970  5S------(83)— event.phase is will

13:42:39.970  5S------(87)— event.params.rowNumber is (7)

13:42:39.970  5S------(88)— params.rowNumber is (7)

13:42:39.970  5S------(90)— row is (7)

13:42:39.970  5S------(91)— myData is table: 06B37590

13:42:39.970  ERROR: Runtime error

13:42:39.970  C:\Users\dcantera\Documents\Corona Projects\TabBarApp3,2017-04-10e\view5.lua:92: attempt to index field ‘?’ (a nil value)

13:42:39.970  stack traceback:

[/lua]

Can you post your scene:create() function from Scene 5?

Thanks

Rob

sure, here is scene:create

[lua]

function scene:create( event )

local sceneGroup = self.view

– Called when the scene’s view does not exist.

– 

– INSERT code here to initialize the scene

– e.g. add display objects to ‘sceneGroup’, add touch listeners, etc.

– get any params passed into this scene from the touch function in view5

print(“5b-------------------------< view5 scene:create start >----------------------”)

local params = event.params

if (params) then

passedTxt = event.params.howdy

passedRowString = event.params.rowString

passedRowNumber = event.params.rowNumber

myData = event.params.table

print("5C–(33)----< assigned myData table of " … tostring(myData))

print("5C------< passed in table of " … tostring(event.params.table))

print("5C------ params.rowNumber is " … tostring(params.rowNumber))

print("5C------ params.rowString is " … params.rowString)

print("5C—(37)— params.howdy is " … params.howdy)

local i = 5

print(“5C–(40)---- row in table myData[” … i … "].fname is " … myData[i].name)

print("5C------ table reference for myData is " … tostring(myData))

else

print("5C------  no params???    ")

end

print("5C------(43) params.rowNumber is " … tostring(params.RowNumber))

print("5C------(44)passedRowNumberis " … tostring(passedRowNumber))

– create a white background to fill screen

local background = display.newRect( display.contentCenterX, display.contentCenterY, display.contentWidth, display.contentHeight )

background:setFillColor( 0.9,0.9,0.9 ) – white

sceneGroup:insert(background)

end

[/lua]

In Lua, variable names are case sensitive. In line 33 of your create scene you have:

  1. print("5C------(43) params.rowNumber is " … tostring(params.RowNumber))

It should be:

  1. print("5C------(43) params.rowNumber is " … tostring(params.rowNumber))

And what line of code is line 92 in view5.lua?

Rob

rob,

line 92 is commented out. I fixed the reference to RowNumber to rowNumber. missed that one

thanks for taking time to look at this.

daveC

[lua]

print("5S------(87)— event.params.rowNumber is " … event.params.rowNumber )

print("5S------(88)— params.rowNumber is " … params.rowNumber )

–print("5S------(89)— rowNumber is " … rowNumber )

print("5S------(90)— row is " … row )

print("5S------(91)— myData is " … tostring(myData))

–print("5S------(92)-------- myData[row].name is " … myData[row].name)     –< commented out

–print("5S------(93)-------- myData[params.rowNumber].name is " … myData[params.rowNumber].name)

[/lua]

The error:

C:\Users\dcantera\Documents\Corona Projects\TabBarApp3,2017-04-10e\view5.lua:92: attempt to index field ‘?’ (a nil value)

means that in line 92, an index to something is nil. The only thing in line 92 you have a table named myData and you’re trying to find row, which is 7. So perhaps myData[7] is nil. Perhaps myData[7] exists but .name doesn’t exist.

Rob

rob,

this is puzzling, the table, myData in view4.lua, is full though and item 5, Pebbles is found as console print results showed. that’s why I tested it with setting  i = 5, and then printing the .name value just to make sure I had transferred the table successfully from scene4 to scene5 in params.

ugh.

[lua]

local myData = {}

myData[1] = { name=“Fred”,    phone=“555-555-1234”, relationship=“B”, hotFlag=“Y”, lflag="N”}

myData[2] = { name=“Barney”,  phone=“555-555-1235”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[3] = { name=“Wilma”,   phone=“555-555-1236”, relationship=“S”, hotFlag=“Y”, lflag="N”}

myData[4] = { name=“Betty”,   phone=“555-555-1237”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[5] = { name=“Pebbles”, phone=“555-555-1238”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[6] = { name=“BamBam”,  phone=“555-555-1239”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[7] = { name=“Dino”,    phone=“555-555-1240”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[8] = { name=“FredB”,    phone=“555-555-1234”, relationship=“BS”, hotFlag=“N”, lflag="N”}

myData[9] = { name=“BarneyB”,  phone=“555-555-1235”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[10] = { name=“WilmaB”,   phone=“555-555-1236”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[11] = { name=“BettyB”,   phone=“555-555-1237”, relationship=“B”, hotFlag=“N”, lflag=“N”}

myData[12] = { name=“PebblesB”, phone=“555-555-1238”, relationship=“S”, hotFlag=“N”, lflag="N”}

myData[13] = { name=“BamBamB”,  phone=“555-555-1239”, relationship=“B”, hotFlag=“N”, lflag=“N”}

myData[14] = { name=“DinoB”,    phone=“555-555-1240”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[15] = { name=“WilmaC”,   phone=“555-555-1236”, relationship=“S”, hotFlag=“N”, lflag="N”}

myData[16] = { name=“CettyC”,   phone=“555-555-1237”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[17] = { name=“PebblesC”, phone=“555-555-1238”, relationship=“BS”, hotFlag=“N”, lflag=“N”}

myData[18] = { name=“CamCamC”,  phone=“555-555-1239”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[19] = { name=“DinoC”,    phone=“555-555-1240”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[20] = { name=“WilmaD”,   phone=“555-555-1236”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[21] = { name=“DettyD”,   phone=“555-555-1237”, relationship=“S”, hotFlag=“N”, lflag="N”}

myData[22] = { name=“PebblesD”, phone=“555-555-1238”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[23] = { name=“DamDamD”,  phone=“555-555-1239”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[24] = { name=“DinoD”,    phone=“555-555-1240”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[25] = { name=“WilmaD”,   phone=“555-555-1236”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[26] = { name=“DettyD”,   phone=“555-555-1237”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[27] = { name=“PebblesD”, phone=“555-555-1238”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[28] = { name=“DamDamD”,  phone=“555-555-1239”, relationship=“B”, hotFlag=“N”, lflag="N”}

myData[29] = { name=“DinoD”,    phone=“555-555-1240”, relationship=“B”, hotFlag=“N”, lflag="N”}

[/lua]

I was a little unclear as to what you were specifically having an issue with. The topic indicates passing composer parameters, but the description indicates you can’t get the row you selected. This will hopefully answer the row question and let you move forward.

I think what you might be looking for is this… You either want the event.target or the event.target.index depending on your needs.

onRowTouch (optional)

Listener. The function used to listen for TableViewWidget touch/tap events. In this listener function, the event.phase values include “tap”, “press”, “release”, “swipeLeft”, and “swipeRight”. In addition, event.target is a reference to the row that was interacted with and event.target.index is the index number of that row

 

https://docs.coronalabs.com/api/library/widget/newTableView.html#onrowtouch-optional

In your onRowRender() function you never set a row.value value so when onRowTouch happens and this line executes:

local selectedRow = event.row.value

event.row.value is nil.

Somewhere in onRowRender you need to do a:

row.value = somevalue

Rob

rob, graham07,

thanks for your reply. that did help solve the the problem and I found the root problem which actual was/is… I don’t understand the object event details. upon further research, it is unclear from:

     https://docs.coronalabs.com/api/event/touch/index.html

that event.target.index, event.target.row.value,  or event.target.row exist or not as a component of the object event or event.target. as an example, from the doc page on widgets:

widget.newTableView( options )

options are clearly defined so it’s easy to figure out how to use them. but on events/touch… there is no mention of *.index, *.row, *.value, *.text so I didn’t know how to reference the row touched past the variable event.row in onRenderRow( event )

is there somewhere (i.e. a webpage or docs) I can research the actual object details for events and other objects other than looking through the source code?

thanks again for your support of the forum and corona.

daveC

For the functions that handle onRowRender() and onRowTouch(), there will be an “event” table that will have various members. One of those is:

event.row

This is the display group that holds the row’s display objects. But it’s a Lua table which means you can add your own key/value pairs to it.

Many people not only add the display objects to the group but also store the pointer to the object as well. This way when you’re in your onRowTouch function you can have an easy reference to the objects that make up the row. 

The documentation you pointed to is for touch events which has an event.target member. The widget.newTableView() manages your touch events for you. And that event has different members to the event table.

Rob

ok, onto the next step…

scope, smope. I contend that corona has no concept of scope cause I’m old school, that is not scope as I know it from any other language… if you set a variable in a block, it should be set in the entire block. I read the lua docs (3.5 – Visibility Rules), x = x but oh, x doesn’t equal x,  the right side x is an old x, (which persists) and the left side x is a new x… not confusing at all, haha.

so I have a similar issues with the below code where I’ve got the params coming in from a scene transition, rowString, rowNumber (just to be sure used number and string vars), a table, (now I’m adventurous), and they all pass from scene4 to scene5 nicely. I can see the references to each param and table contiguous as the program proceeds. line (33) table is referenced as table: 06B37590 which continues throughout, the rowNumber and rowString (being passed both as a number and a string) also continues throughout. 

so the question I have is, if I assign i = 5 and print myData[5].name I get ‘pebbles’ in multiple places, lines 40, 76 but if I reference myData[row].name, myData[rowNumber].name, myData[params.rowNumber].name, or myData[event.params.rowNumber].name I get an error, the damn ‘nil’ issue…

what am I missing on the scope issues of lua???

thanks,

daveC

[lua]

function scene:show( event )

local sceneGroup = self.view

print(“5c-------------------------< view5 scene:show start >----------------------”)

local params = event.params

if (params) then

passedTxt = event.params.howdy

passedRowString = event.params.rowString

passedRowNumber = event.params.rowNumber

myData = event.params.table

row = event.params.rowNumber

print("5C------ params.rowNumber is " … tostring(params.rowNumber))

print("5C------ params.rowString is " … params.rowString)

print("5C–(73)---- params.howdy is " … params.howdy)

local i = 5

print(“5C–(76)---- row in table myData[” … i … "].fname is " … myData[i].name)

print("5C------ table reference for myData is " … tostring(myData))

else

print("5C------  no params???    ")

end

print("5S------(82)— row is " … row )

print("5S------(83)— event.phase is " … event.phase)

—================================================================

print("5S------(87)— event.params.rowNumber is " … event.params.rowNumber )

print("5S------(88)— params.rowNumber is " … params.rowNumber )

–print("5S------(89)— rowNumber is " … rowNumber )

print("5S------(90)— row is " … row )

print("5S------(91)— myData is " … tostring(myData))

print("5S------(92)-------- myData[row].name is " … myData[row].name)

print("5S------(93)-------- myData[params.rowNumber].name is " … myData[params.rowNumber].name)

**********************************************

**********************************************

13:42:39.860  Scroll view was touched

13:42:39.860  (46)-----onRowTouch------- event.target is table: 06BD0E50

13:42:39.970  4--------onRowTouch------- event.target is table: 06BD0E50

13:42:39.970  4--------onRowTouch------- event.target.index is 7

13:42:39.970  4--------onRowTouch------- event.row is table: 06BD0E50

13:42:39.970  4--------onRowTouch------- tostring(row) is 7

scene4 above

13:42:39.970  5a-------------------------< view5 start >----------------------

13:42:39.970  5b-------------------------< view5 scene:create start >----------------------

13:42:39.970  5C–(33)----< assigned myData table of table: 06B37590

13:42:39.970  5C------< passed in table of table: 06B37590

13:42:39.970  5C------ params.rowNumber is (7)

13:42:39.970  5C------ params.rowString is (7)

13:42:39.970  5C—(37)— params.howdy is hello7

13:42:39.970  5C–(40)---- row in table myData[5].fname is Pebbles

13:42:39.970  5C------ table reference for myData is table: 06B37590

13:42:39.970  5C------(43) params.rowNumber is nil

13:42:39.970  5C------(44)passedRowNumberis (7)

13:42:39.970  5c-------------------------< view5 scene:show start >----------------------

13:42:39.970  5C------ params.rowNumber is (7)

13:42:39.970  5C------ params.rowString is (7)

13:42:39.970  5C–(73)---- params.howdy is hello7

13:42:39.970  5C–(76)---- row in table myData[5].fname is Pebbles

13:42:39.970  5C------ table reference for myData is table: 06B37590

13:42:39.970  5S------(82)— row is (7)

13:42:39.970  5S------(83)— event.phase is will

13:42:39.970  5S------(87)— event.params.rowNumber is (7)

13:42:39.970  5S------(88)— params.rowNumber is (7)

13:42:39.970  5S------(90)— row is (7)

13:42:39.970  5S------(91)— myData is table: 06B37590

13:42:39.970  ERROR: Runtime error

13:42:39.970  C:\Users\dcantera\Documents\Corona Projects\TabBarApp3,2017-04-10e\view5.lua:92: attempt to index field ‘?’ (a nil value)

13:42:39.970  stack traceback:

[/lua]

Can you post your scene:create() function from Scene 5?

Thanks

Rob

sure, here is scene:create

[lua]

function scene:create( event )

local sceneGroup = self.view

– Called when the scene’s view does not exist.

– 

– INSERT code here to initialize the scene

– e.g. add display objects to ‘sceneGroup’, add touch listeners, etc.

– get any params passed into this scene from the touch function in view5

print(“5b-------------------------< view5 scene:create start >----------------------”)

local params = event.params

if (params) then

passedTxt = event.params.howdy

passedRowString = event.params.rowString

passedRowNumber = event.params.rowNumber

myData = event.params.table

print("5C–(33)----< assigned myData table of " … tostring(myData))

print("5C------< passed in table of " … tostring(event.params.table))

print("5C------ params.rowNumber is " … tostring(params.rowNumber))

print("5C------ params.rowString is " … params.rowString)

print("5C—(37)— params.howdy is " … params.howdy)

local i = 5

print(“5C–(40)---- row in table myData[” … i … "].fname is " … myData[i].name)

print("5C------ table reference for myData is " … tostring(myData))

else

print("5C------  no params???    ")

end

print("5C------(43) params.rowNumber is " … tostring(params.RowNumber))

print("5C------(44)passedRowNumberis " … tostring(passedRowNumber))

– create a white background to fill screen

local background = display.newRect( display.contentCenterX, display.contentCenterY, display.contentWidth, display.contentHeight )

background:setFillColor( 0.9,0.9,0.9 ) – white

sceneGroup:insert(background)

end

[/lua]

In Lua, variable names are case sensitive. In line 33 of your create scene you have:

  1. print("5C------(43) params.rowNumber is " … tostring(params.RowNumber))

It should be:

  1. print("5C------(43) params.rowNumber is " … tostring(params.rowNumber))

And what line of code is line 92 in view5.lua?

Rob