I don't know if this is a bug or feature, but it seems to me that nested loops do not work.
I attempted to use the following code, debugging the text showed that only one loop occurred:
local x=0 local y=0 while(x<16) do while(y<16) do val=mget(x,y) print(val) y+=1 end x+=1 end |
I don't know if this is intended or a limit of lua, but I was able to work around it with the following code:
local i=0 while(i<256) do local x=i%16 local y=(i-x)/16 val=mget(x,y) print(val) i+=1 end |

Hey.
I really like PICO-8 - it's really helpful to be able to learn a little tool, and stay inside that same tool until I finish a whole game.
However, one of my goals in playing with PICO-8 is to practice Lua.
Is there a way to turn off the PICO-8 specific syntax, so that I don't acquire "bad habits" of using += or whatever?
Thanks!
Johnicholas

I'm not 100% sure this is working correctly but it was a good first try.
-- conway's game of life
-- by ian seyler
maxinit=1400
cls()
for t=1,maxinit do
x=rnd(127)
y=rnd(127)
pset(x,y,15)
end
while(1) do
for y=0,127 do
for x=0,127 do
neigh=0
for tx=-1,1 do
for ty=-1,1 do
if(pget(x+tx,y+ty)==15) then
neigh+=1
end
end
end
if(pget(x,y)==15) then
neigh-=1
if(neigh<2 or neigh>3) then
pset(x,y,0)
end
elseif(pget(x,y)==0) then
if(neigh==3) then
pset(x,y,15)
end
end
end
end
end
|

While studying the jelpi.p8 file I noticed that its using some things that aren't documented in the manual (pico-8.txt) file so I figured I'd post it here.
Missing math function:
sgn(x) returns -1, 0, or 1 based on the sign of the input value, currently passing in 0 returns 1 (maybe a bug)
Missing optional properties:
spr(n, x, y, [w, y, [flip]] the normal draw sprite function can also take the optional flip bool (not documented)
The Argus is watching all, always,. .
(small graphic/sound test)
loving the hard limits of this system,.
except the color limit, can we currently peek/poke to dynamically alter the colors in the 16 ?
I like the limit of 16 palette,. however would rather be able to change these sometimes., all greens or blues,. cycle one, etc.
very cool system otherwise.
So far I found these bugs in the code editor (v0.1.0 on Windows):
- Delete key doesn't work when cursor is at the very beginning of the program (also applies to the command line).
- Copy-pasting adds a blank character at the end of each pasted line.
- Shift-Home and Shift-End don't work properly.
- Saving and reloading the cartridge adds a newline at the end, resulting in lots of blank lines over time.





0 comments








