Author Topic: strings..  (Read 3723 times)

0 Members and 1 Guest are viewing this topic.

Offline LDStudios

  • Coder Of Tomorrow
  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 388
  • Rating: +41/-1
    • View Profile
    • LD Studios
strings..
« on: January 14, 2014, 06:21:23 am »
Does anyone know why commands like \n (new line) and \b (backspace) work fine for me in student software, but on calc, they just display a rectangle



Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: strings..
« Reply #1 on: January 14, 2014, 11:21:45 am »
Yep, it's a known issue - don't rely on them.
Instead, split the string yourself (at each \n) and store the parts in a table which you'll iterate through and call drawString on each parts.

example :
Code: [Select]
local myTable = myString:split("\n")
    for i, str in ipairs(myTable ) do
        gc:drawString(str, 5, 5 + i * 10, "top")
    end
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation