Shifting a string...can't get my head around it


Active Member
Hey guys,

I've been working with controlling an LCD via Girder using the serial out plugin and I've hit a little snag I'm hoping you can help with.

I can get all the text to display and have it all layed out great, except for one small problem. If the Artist name or the Track name are longer than 20 characters, the LCD writes to the next line.

What I need to do is write some code in Lua that can detect the string being longer than 20 characters, then print characters 1-21, 2-22, 3-23, etc then loop back to character 1 and start over.

I'm can't figure out how to do the looping on this. I've got the code so that the original string gets broken up into byte sized parts, converted to hex, then recombined and displayed, just can't seem to get it to scroll.

Any ideas?