Is multiple assignment possible within a table, e.g.
e={ x,y,health,timer=0,0,0,0, score_val=100, colour=7 } |
When I do that, for some reason the timer value is returning nil.
Or, is there a limit to the number of multiple assignments? I am currently setting 16 variables to zero.



I just googled lua multiple assignment and got this stack overflow page that answers pretty thoroughly:
https://stackoverflow.com/questions/31780277/lua-multiple-assignment-with-tables
Judging from what that says, I think the closest way to what you have would be this:
e = {} e.x,e.y,e.heath,e.time=0,0,0,0 e.score_val=100 e.colour=7 |
I'm not sure it'd be worth it though, since I think that'd be more tokens than just setting them individual in the initial table assignment.



Yeah, I already saw that, but it's no use, as the whole point of me using multiple assignment within tables was to save tokens.



You can use this trick with _ENV. It hides the environment and only becomes interesting with 8 elements or more.
e={} do local _𝘦𝘯𝘷 = e x,y,health,timer,score_val,colour = 0,0,0,0,100,7 end |



That's perfect. Someone should add that to the Pico-8 guide for token reduction.
[Please log in to post a comment]