How do u make a table

Like with rows and columns

Anyone know how to

(Please only post your questions once)

rows = 10
cols = 10
-- initialisation
t = {}
for i=1,rows do
    t[i] = {}
end
-- setting
for i=1,rows do
    for j=1,cols do
        t[i][j] = math.random(0,9)
    end
end
-- accessing
print(t[3][4])

To Mnjk78lg


--random numbers in a table

-- Use this function to perform your initial setup
function setup()
    print("Hello World!")
    rows = 10
    cols = 10
-- initialisation
t = {}
for i=1,rows do
    t[i] = {}
end
-- setting random numbers
    for i=1,rows do
        for j=1,cols do
            t[i][j] = math.random(1,49)
            print("Row "..i .." Col "..j .." = "..t[i][j])
        end
    end
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(40, 40, 50)
    
    -- This sets the line thickness
    strokeWidth(3)

    -- Do your drawing here
    noFill()
    rectMode(CENTER)
    for i=100,480,40 do
        for j= 340,700,40 do
    rect(i,j,40,40)
    end
    end
    
    fill(255)
    for  y =  1,10 do
        for x = 1,10 do
            text(t[x][y],60 + y*40,740-x*40)
        end
    end
end