How to use table ?

Hi, i’m new comer in Codea And Lua And i have some troubles with lua tables. Could someone explain me what i’m doing wrong in this attemp of drawing à 10x10 board game?
Thanks

--# Main


function setup()
    -- sens du jeu
    supportedOrientations(PORTRAIT)
    --displayMode(FULLSCREEN)
    
    -- definition des variables globales
    blanc=color(255, 255, 255, 255)
    noir=color(0, 0, 0, 255)
    vide= color(0, 0, 0, 43)
    nbrCases= 10
    diam=WIDTH/(nbrCases+2)
    
    -- génération du plateau de jeu
    -- plateau[ligne][colonne]
    cases={}
    for l=1 , nbrCases do
        for i=1 , nbrCases do
        cases[l][i]=vide
        end
    end
    
    -- placement des billes de départ
    ctr=nbrCases/2
    -- cases[5][5]=blanc
    -- creation du plateau
    jeu = Plateau()
end

function draw()
    background(40, 40, 50)
    jeu:draw()
end
--# Plateau
Plateau = class()

function Plateau:init()
    pimage=image(WIDTH,WIDTH)
    setContext(pimage)
    background(135, 78, 39, 255)

    for i,lig in ipairs(cases) do
        for j=1, nbrCases do
            if lig[j]~=vide then
                fill(lig[j])
                else fill(vide)
            end
            ellipse((diam/2)+diam*i,(diam/2)+diam*j,diam,diam)
            text(i.." "..j,(diam/2)+diam*i,(diam/2)+diam*j)
        end
    end
    setContext()
end

function Plateau:draw()
    sprite(pimage,WIDTH/2,HEIGHT/2)
end

You initialize the cases, but not the inner tables…


    cases={}
    for l=1 , nbrCases do

       cases[l]={}


        for i=1 , nbrCases do
        cases[l][i]=vide
 

And then it works

You’ll find all the answers here: http://www.lua.org/pil/index.html

Thanks a lot. The solution was so simple that i feel shameful.

No shame in asking for help, @Burobox! Sometimes a fresh pair of eyes helps.

And one hint, I personally wouldn’t use L for this as a variable, because it can easily mistaken as a 1

1l1ili1

That’s the reason why I love profont http://www.tobias-jung.de/seekingprofont
It was designed to prevent that kind of mistakes. Like O and 0, l and I and so fort.