How would I design Multiple Lines of Text

Hey all, I couldn’t find a good way to name this title, but I need help with something. I need to be able to, say, click on the screen and a little one will appear to the left, next to where I will type. When I type stuff, and then when I press enter, it starts another line with a 2 instead of a one and so on. I go the showKeyboard() and touch functions to work and all, but I just can’t seem to get the numbers on the left to appear and my text on the right (which the user writes) to show at all. Thanks.

post your current code (running without bugs), and i’ll add what you’re after.

@Perscirious Here’s a start. Tap the screen to show a 1. Type what you want. Press return to show the next line number. Press backspace to erase characters. When you erase all the characters on a line, continuing will erase the line number and take you to the previous line.


displayMode(FULLSCREEN)

function setup()
    textMode(CORNER)
    tab={}
    line=0
    str=""
end

function draw()
    background(0)
    fill(255)
    for a,b in pairs(tab) do
        text(b,10,HEIGHT-a*20)   
    end
    text(str,10,HEIGHT-(#tab+1)*20)
end

function touched(t)
    if not isKeyboardShowing() then
        showKeyboard()
    end
    if t.state==BEGAN and line==0 then
        line=line+1
        str=string.format("%2d )  ",line)
        showKeyboard()
    end
end

function keyboard(k)
    if k==RETURN then
        table.insert(tab,str)
        line=line+1
        str=string.format("%2d )  ",line)
    elseif k==BACKSPACE then
        if string.len(str)>6 then
            str=string.sub(str,1,string.len(str)-1)
        elseif line>1 then
            line=line-1
            str=tab[line]  
            table.remove(tab,line)          
        end
    else
        str=str..k
    end 
end