Problem Concatenating Strings Extracted From a Table

What version of Corona SDK are you using?

Rob and JonPM - Sorry for the delayed response - I have been out of town. To answer Rob’s question, this issue appears when using builds 2016.2686, 2016.2873, and 2016.2874. However, I have identified the problem and was able to fix it pretty easily. The problem did not have to do with the width of the displayed text, but thanks JonPM for suggesting that possibility.

More specifically, the the string elements I inserted into the table to begin with each had a new line following them. This was because all of the elements in the table I originally extracted from a text file using the following code. Sorry, I realize it probably would have been helpful to you if I mentioned this in my original post, but I did not think this would be the source of the problem.

readWordsFromFile = function( wordList ) local wordTable = {} local path = system.pathForFile( wordList, system.ResourceDirectory ) local file = io.open( path, "r" ) for line in file:lines() do line = string.sub( line, 1, #line ) wordTable[line] = true table.insert( wordTable, line ) end io.close( file ) file = nil return wordTable end local stringTable = readWordsFromFile( "stringList.txt" ) local concatString = table.concat( stringTable, ", " ) print( concatString )

I changed line 7 above to the following, and now the issue does not appear on neither the iOS simulator nor the Windows simulator:

line = string.sub( line, 1, #line - 1 )

I feel a little silly because Rob had actually suggested the code I posted in my previous post when responding to one of my posts last summer, which pertained to searching for elements in tables. The link to that thread is below:

https://forums.coronalabs.com/topic/56720-problem-searching-for-elements-in-a-very-large-table/

Sorry Rob for not catching this - I did not mean to waste your time on something that you had already addressed previously. Nonetheless, it is still odd that my original code worked perfectly fine on the Windows simulator, but not on iOS.

Thanks again Rob and JonPM for your assistance in solving this problem!