Bearv5 [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=61379 Basic questions about tables <p>Hey, hello! I'm a beginner in programming. I followed the tutorial &quot;Game Development using PICO-8 by Dylan Bennett&quot; to learn to use Pico-8. follow the page 28 of the tutorial. I wrote a game which just like &quot;Flappy Bird&quot;, and then I ran into some questions about &quot;tables&quot;.</p> <p>The questions are as follows:<br /> I don't understand what the means about&quot;cave={{[&quot;top&quot;]=5,[&quot;btm&quot;]=119}}&quot;.</p> <img style="margin-bottom:16px" border=0 src="/media/61379/Frame 1 (2).png" alt="" /> <p>The context of this code is as follows(In line 2):</p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre> function make_cave() cave={{[&quot;top&quot;]=5,[&quot;btm&quot;]=119}} top=45 btm=85 end function update_cave() if (#cave&gt;player.speed) then for i=1,player.speed do del (cave,cave[1]) end end while (#cave&lt;128) do local col={} local up=flr(rnd(7)-3) local dwn=flr(rnd(7)-3) col.top=mid(3, cave[#cave].top+up,top) col.btm=mid(btm, cave[#cave].btm+dwn,124) add(cave,col) end end function draw_cave() top_color=5 btm_color=5 for i=1,#cave do line(i-1,0,i-1,cave[i].top, top_color) line(i-1,127,i-1,cave[i].btm, btm_color) end end</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> https://www.lexaloffle.com/bbs/?tid=46382 https://www.lexaloffle.com/bbs/?tid=46382 Sun, 30 Jan 2022 16:38:24 UTC