Log In  
Follow
tōbiō

Front End developer learning Pico 8 because 8-bit games are the best-bit games.

[ :: Read More :: ]

Hi Pico 8 bbs!

I am following Lazy Devs' breakout tutorial, and I noticed he was using variables like so

ball_x=1
ball_y=1

In my code I had written:

ball={
  x=1,
  y=1,
}

However I noticed that he had quite a bit fewer tokens than I did. I switched over, and sure enough, saved a bunch of tokens. This is because ball_x is only one token, whereas ball["x"] is quite a few more.

So then if straight-up variables are cheaper than tokens, it leads me to the question:

When is it actually a good idea to use tables instead of just variables?

Thanks!

P#138760 2023-12-16 07:52