How to use "maxTextureSize" in system.getInfo()?

I found there is a info about max texture size in system.getInfo()

maxTextureSize "maxTextureSize" returns the maximum texture width or height supported by the device.

How to use this info?

Sometimes I use display.newText() to show large amount of texts and it may go totally blank. The reason, as Corona staff explained, is because it exceeds the maximum texture size allowed in the device.

So is it possible to use this info to determine if the texts I am going to show will exceed the maximum texture size? If so, I can try to cut off some texts instead of showing “blank screen”.

I print out the maxTextureSize in the Simulator, and it is “16384”… do you know how it is calculated and how I can use it to determine if the texture size used in a display.newText() call would exceed it?

The max texture size is a value returned by the operating system based on the capacity of the GPU of the device.  On a Mac, that number is insanely large.  The 16384 means your computer can use a 16,384 x 16,384 image.  Some high density tablets might be 4096x4096, some older devices might only be 1024x1024.  You can use this to determine how big your images can be.

You could use this value and if you get a display.newText who’s height is greater than the maxTextureValue then you could dispose of the display.newText and build a new one based on less text.  But you might have better luck doing some simple math.  You can take the maxTextureSize and divide it by font height with some overhead for line spacing.  Perhaps:

maxLines = maxTextureValue / (fontSize * 1.1)

If the screen has other graphics, does it affect the calculation?

It won’t have anything to do with anything else.  You’re just making a decision regarding how much text to put in your display.newText.

The max texture size is a value returned by the operating system based on the capacity of the GPU of the device.  On a Mac, that number is insanely large.  The 16384 means your computer can use a 16,384 x 16,384 image.  Some high density tablets might be 4096x4096, some older devices might only be 1024x1024.  You can use this to determine how big your images can be.

You could use this value and if you get a display.newText who’s height is greater than the maxTextureValue then you could dispose of the display.newText and build a new one based on less text.  But you might have better luck doing some simple math.  You can take the maxTextureSize and divide it by font height with some overhead for line spacing.  Perhaps:

maxLines = maxTextureValue / (fontSize * 1.1)

If the screen has other graphics, does it affect the calculation?

It won’t have anything to do with anything else.  You’re just making a decision regarding how much text to put in your display.newText.