Params not behaving same between device and simulator

I have a storyboard scene calling another one and passing it a table in params. When the table is a simple one it works on both the device and simulator. Such as the following

simpleTable = { “item1”, “item2”, “item3” } – is received well on both simulator and device.

When I use a 2 dimensional table such as the following it still works very well on the simulator but on the device (iPhone) the table simply does not reach the receiving scene. It just comes through as an empty table.

complexTable =  {   {“item1”, “color1”, “temp1”},

                                {“item2”, “color2”, “temp2”},

                                {“item3”, “color3”, “temp3”}

                            } 

I looked at the API details and it clearly says the following for params : 

"You may optionally pass any kind of custom data that you want transferred to the next scene via event listeners. "

Anyone else seen anything like this? Any suggestions?

@ksan,

I think you might have an error in your code.  I just wrote up a quick test and confirmed data passing of a multi-level table in storyboard.

My example was written using Corona 2014.2179 on a Windows 7 system.  I confirmed the output on the simulator and a Nexus 7 using logcat to dump the Nexus log.

You can get the example code here.  The whole example is too long to post in its entirely, but here is the essence of what I did:

main.lua - passing table to storyboard scene:

local myTable = {  { "Bob", "is", "your", "uncle" }, { "Corona", "Rocks!"}, { "Roaming Gamer", "ain't to bad", "either"} } local options = {     effect = "fade",     time = 200,     params =     {         dataSource = myTable     } } storyboard.gotoScene( "aScene", options  )   

aScene.lua - Extracting the table. (my sample does something a little different, but this is simpler to grok):

function scene:createScene( event ) screenGroup = self.view local myTable = event.params.dataSource end   

-Ed

PS here is the debug output of my actual program

Windows 7 Simulator

main.lua \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* ENTER Dump of myTable in main.lua - Notice 'addresses' of sub-tables: Table Dump: ----- 1 (number)                     == table: 06D9AAF8 (string) 2 (number)                     == table: 06D9AB48 (string) 3 (number)                     == table: 06D9AB98 (string) ----- Recursiuve print of myTable in main.lua: table: 06D9AB20 {  [1] =\> table: 06D9AB20 {    [1] =\> "Bob"    [2] =\> "is"    [3] =\> "your"    [4] =\> "uncle"    }  [2] =\> table: 06D9AB20 {    [1] =\> "Corona"    [2] =\> "Rocks!"    }  [3] =\> table: 06D9AB20 {    [1] =\> "Roaming Gamer"    [2] =\> "ain't to bad"    [3] =\> "either"    } } main.lua \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* EXIT aScene.lua \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* ENTER Recursiuve print of scene:createScene() event in aScene.lua: table: 06D632E0 {  [name] =\> "createScene"  [params] =\> table: 06D632E0 {         [dataSource] =\> table: 06D9AEB8 {                    [1] =\> table: 06D9AB20 {                      [1] =\> "Bob"                      [2] =\> "is"                      [3] =\> "your"                      [4] =\> "uncle"                      }                    [2] =\> table: 06D9AB20 {                      [1] =\> "Corona"                      [2] =\> "Rocks!"                      }                    [3] =\> table: 06D9AB20 {                      [1] =\> "Roaming Gamer"                      [2] =\> "ain't to bad"                      [3] =\> "either"                      }                    }         } } Notice that the original table is passed as event.params.dataSource and that it is the same table as was created in main.lua. Table Dump: ----- 1 (number)                     == table: 06D9AAF8 (string) 2 (number)                     == table: 06D9AB48 (string) 3 (number)                     == table: 06D9AB98 (string) -----  

Nexus 7 (via logcat)

I/Corona  (23573): main.lua \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* ENTER I/Corona  (23573): I/Corona  (23573): I/Corona  (23573): Dump of myTable in main.lua - Notice 'addresses' of sub-tables: I/Corona  (23573): Table Dump: I/Corona  (23573): ----- I/Corona  (23573): 1 (number)                     == table: 0x686de2c0 (string) I/Corona  (23573): 2 (number)                     == table: 0x686de330 (string) I/Corona  (23573): 3 (number)                     == table: 0x686de380 (string) I/Corona  (23573): ----- I/Corona  (23573): I/Corona  (23573): I/Corona  (23573): Recursiuve print of myTable in main.lua: I/Corona  (23573): table: 0x686de260 { I/Corona  (23573):  [1] =\> table: 0x686de260 { I/Corona  (23573):    [1] =\> "Bob" I/Corona  (23573):    [2] =\> "is" I/Corona  (23573):    [3] =\> "your" I/Corona  (23573):    [4] =\> "uncle" I/Corona  (23573):    } I/Corona  (23573):  [2] =\> table: 0x686de260 { I/Corona  (23573):    [1] =\> "Corona" I/Corona  (23573):    [2] =\> "Rocks!" I/Corona  (23573):    } I/Corona  (23573):  [3] =\> table: 0x686de260 { I/Corona  (23573):    [1] =\> "Roaming Gamer" I/Corona  (23573):    [2] =\> "ain't to bad" I/Corona  (23573):    [3] =\> "either" I/Corona  (23573):    } I/Corona  (23573): } I/Corona  (23573): main.lua \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* EXIT I/Corona  (23573): aScene.lua \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* ENTER I/Corona  (23573): I/Corona  (23573): I/Corona  (23573): Recursiuve print of scene:createScene() event in aScene.lua: I/Corona  (23573): table: 0x6876d120 { I/Corona  (23573):  [name] =\> "createScene" I/Corona  (23573):  [params] =\> table: 0x6876d120 { I/Corona  (23573):         [dataSource] =\> table: 0x6876b008 { I/Corona  (23573):                    [1] =\> table: 0x686de260 { I/Corona  (23573):                      [1] =\> "Bob" I/Corona  (23573):                      [2] =\> "is" I/Corona  (23573):                      [3] =\> "your" I/Corona  (23573):                      [4] =\> "uncle" I/Corona  (23573):                      } I/Corona  (23573):                    [2] =\> table: 0x686de260 { I/Corona  (23573):                      [1] =\> "Corona" I/Corona  (23573):                      [2] =\> "Rocks!" I/Corona  (23573):                      } I/Corona  (23573):                    [3] =\> table: 0x686de260 { I/Corona  (23573):                      [1] =\> "Roaming Gamer" I/Corona  (23573):                      [2] =\> "ain't to bad" I/Corona  (23573):                      [3] =\> "either" I/Corona  (23573):                      } I/Corona  (23573):                    } I/Corona  (23573):         } I/Corona  (23573): } I/Corona  (23573): I/Corona  (23573): I/Corona  (23573): Notice that the original table is passed as event.params.dataSource and that it is the same table as was created in main.lua. I/Corona  (23573): Table Dump: I/Corona  (23573): ----- I/Corona  (23573): 1 (number)                     == table: 0x686de2c0 (string) I/Corona  (23573): 2 (number)                     == table: 0x686de330 (string) I/Corona  (23573): 3 (number)                     == table: 0x686de380 (string) I/Corona  (23573): ----- 

Hi Ed, 

Thank you very much for taking the time to verify this. I used the CL’s Storyboard sample to do a very similar test and it did indeed work there as well. So yes, this one comes down to my code somehow. It is very bizarre though how it works perfectly in the simulator and not on the device. I will try to get to the bottom of it and post it back here so others can avoid the same pitfall. 

Regards & thanks,

Kerem

@ksan,

Pay particular attention to how you set up the ‘options’ table and the ‘params’ subtable.  when you call gotoScene().

You might consider posting the entire example here i.e. Your options table and the call to gotoScene() so we can see if there is an error there.

-Ed

The table is coming from a db source and I think I discovered that simulator vs device has different tolerance levels for unescaped characters. After carefully watching the data coming in I think I solved the issue for now but will continue monitoring.

@ksan,

I think you might have an error in your code.  I just wrote up a quick test and confirmed data passing of a multi-level table in storyboard.

My example was written using Corona 2014.2179 on a Windows 7 system.  I confirmed the output on the simulator and a Nexus 7 using logcat to dump the Nexus log.

You can get the example code here.  The whole example is too long to post in its entirely, but here is the essence of what I did:

main.lua - passing table to storyboard scene:

local myTable = {  { "Bob", "is", "your", "uncle" }, { "Corona", "Rocks!"}, { "Roaming Gamer", "ain't to bad", "either"} } local options = {     effect = "fade",     time = 200,     params =     {         dataSource = myTable     } } storyboard.gotoScene( "aScene", options  )   

aScene.lua - Extracting the table. (my sample does something a little different, but this is simpler to grok):

function scene:createScene( event ) screenGroup = self.view local myTable = event.params.dataSource end   

-Ed

PS here is the debug output of my actual program

Windows 7 Simulator

main.lua \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* ENTER Dump of myTable in main.lua - Notice 'addresses' of sub-tables: Table Dump: ----- 1 (number)                     == table: 06D9AAF8 (string) 2 (number)                     == table: 06D9AB48 (string) 3 (number)                     == table: 06D9AB98 (string) ----- Recursiuve print of myTable in main.lua: table: 06D9AB20 {  [1] =\> table: 06D9AB20 {    [1] =\> "Bob"    [2] =\> "is"    [3] =\> "your"    [4] =\> "uncle"    }  [2] =\> table: 06D9AB20 {    [1] =\> "Corona"    [2] =\> "Rocks!"    }  [3] =\> table: 06D9AB20 {    [1] =\> "Roaming Gamer"    [2] =\> "ain't to bad"    [3] =\> "either"    } } main.lua \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* EXIT aScene.lua \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* ENTER Recursiuve print of scene:createScene() event in aScene.lua: table: 06D632E0 {  [name] =\> "createScene"  [params] =\> table: 06D632E0 {         [dataSource] =\> table: 06D9AEB8 {                    [1] =\> table: 06D9AB20 {                      [1] =\> "Bob"                      [2] =\> "is"                      [3] =\> "your"                      [4] =\> "uncle"                      }                    [2] =\> table: 06D9AB20 {                      [1] =\> "Corona"                      [2] =\> "Rocks!"                      }                    [3] =\> table: 06D9AB20 {                      [1] =\> "Roaming Gamer"                      [2] =\> "ain't to bad"                      [3] =\> "either"                      }                    }         } } Notice that the original table is passed as event.params.dataSource and that it is the same table as was created in main.lua. Table Dump: ----- 1 (number)                     == table: 06D9AAF8 (string) 2 (number)                     == table: 06D9AB48 (string) 3 (number)                     == table: 06D9AB98 (string) -----  

Nexus 7 (via logcat)

I/Corona  (23573): main.lua \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* ENTER I/Corona  (23573): I/Corona  (23573): I/Corona  (23573): Dump of myTable in main.lua - Notice 'addresses' of sub-tables: I/Corona  (23573): Table Dump: I/Corona  (23573): ----- I/Corona  (23573): 1 (number)                     == table: 0x686de2c0 (string) I/Corona  (23573): 2 (number)                     == table: 0x686de330 (string) I/Corona  (23573): 3 (number)                     == table: 0x686de380 (string) I/Corona  (23573): ----- I/Corona  (23573): I/Corona  (23573): I/Corona  (23573): Recursiuve print of myTable in main.lua: I/Corona  (23573): table: 0x686de260 { I/Corona  (23573):  [1] =\> table: 0x686de260 { I/Corona  (23573):    [1] =\> "Bob" I/Corona  (23573):    [2] =\> "is" I/Corona  (23573):    [3] =\> "your" I/Corona  (23573):    [4] =\> "uncle" I/Corona  (23573):    } I/Corona  (23573):  [2] =\> table: 0x686de260 { I/Corona  (23573):    [1] =\> "Corona" I/Corona  (23573):    [2] =\> "Rocks!" I/Corona  (23573):    } I/Corona  (23573):  [3] =\> table: 0x686de260 { I/Corona  (23573):    [1] =\> "Roaming Gamer" I/Corona  (23573):    [2] =\> "ain't to bad" I/Corona  (23573):    [3] =\> "either" I/Corona  (23573):    } I/Corona  (23573): } I/Corona  (23573): main.lua \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* EXIT I/Corona  (23573): aScene.lua \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* ENTER I/Corona  (23573): I/Corona  (23573): I/Corona  (23573): Recursiuve print of scene:createScene() event in aScene.lua: I/Corona  (23573): table: 0x6876d120 { I/Corona  (23573):  [name] =\> "createScene" I/Corona  (23573):  [params] =\> table: 0x6876d120 { I/Corona  (23573):         [dataSource] =\> table: 0x6876b008 { I/Corona  (23573):                    [1] =\> table: 0x686de260 { I/Corona  (23573):                      [1] =\> "Bob" I/Corona  (23573):                      [2] =\> "is" I/Corona  (23573):                      [3] =\> "your" I/Corona  (23573):                      [4] =\> "uncle" I/Corona  (23573):                      } I/Corona  (23573):                    [2] =\> table: 0x686de260 { I/Corona  (23573):                      [1] =\> "Corona" I/Corona  (23573):                      [2] =\> "Rocks!" I/Corona  (23573):                      } I/Corona  (23573):                    [3] =\> table: 0x686de260 { I/Corona  (23573):                      [1] =\> "Roaming Gamer" I/Corona  (23573):                      [2] =\> "ain't to bad" I/Corona  (23573):                      [3] =\> "either" I/Corona  (23573):                      } I/Corona  (23573):                    } I/Corona  (23573):         } I/Corona  (23573): } I/Corona  (23573): I/Corona  (23573): I/Corona  (23573): Notice that the original table is passed as event.params.dataSource and that it is the same table as was created in main.lua. I/Corona  (23573): Table Dump: I/Corona  (23573): ----- I/Corona  (23573): 1 (number)                     == table: 0x686de2c0 (string) I/Corona  (23573): 2 (number)                     == table: 0x686de330 (string) I/Corona  (23573): 3 (number)                     == table: 0x686de380 (string) I/Corona  (23573): ----- 

Hi Ed, 

Thank you very much for taking the time to verify this. I used the CL’s Storyboard sample to do a very similar test and it did indeed work there as well. So yes, this one comes down to my code somehow. It is very bizarre though how it works perfectly in the simulator and not on the device. I will try to get to the bottom of it and post it back here so others can avoid the same pitfall. 

Regards & thanks,

Kerem

@ksan,

Pay particular attention to how you set up the ‘options’ table and the ‘params’ subtable.  when you call gotoScene().

You might consider posting the entire example here i.e. Your options table and the call to gotoScene() so we can see if there is an error there.

-Ed

The table is coming from a db source and I think I discovered that simulator vs device has different tolerance levels for unescaped characters. After carefully watching the data coming in I think I solved the issue for now but will continue monitoring.