Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Texting al values from a table

in General Posts: 8

Hello, have again a question, is it possible to show all values of a table with the functon text().
So for example a table strList, when i put this in the text function, I Have to write which position I want to display.
So for example: text(strList[positionofvalue], 200, 200), so how can I let him display all the values ,without writing the function again and again each with an other postion?

Tagged:

Comments

  • edited June 2015 Posts: 2,020
    local textHeight = 20
    for i=1,#strList do
        text(strList[i],200,HEIGHT-(i*textHeight))
    end
    
  • dave1707dave1707 Mod
    Posts: 7,809

    @SvCoder Depending on what you have in the table, you could use something like this also.


    function setup() textMode(CORNER) tab={1,2,3,4,5,6,7,8} end function draw() background(0) fill(255) text(table.concat(tab,"\n"),WIDTH/2,0) end
Sign In or Register to comment.