Retrogamecoding(.org) > CybermonkeyLua
ChipmonkeyLua v1.0
Cybermonkey:
After CMBASIC, here's CMLua which is further developed now. All binaries are in one ZIP, too:
http://egsl.retrogamecoding.org/media/chipmonkey/CMLua.zip
Examples are included and as usual a few screenshots:
Tomaaz:
Well, I wasn't sure about this project but it turned up pretty cool. I can't see what else could be done if we're talking about old-school interpreter. Well done! ;)
Cybermonkey:
Thanks. BTW I forgot two examples.
plasma.lua:
--- Code: -----' my favourite plasma demo
--' ported from smallbasic to yabasic to lua
--' by cybermonkey
cls()
cols={}
cols[0]={}
cols[1]={}
cols[2]={}
for i=0,255 do
cols[0][i]= math.abs(128 - 127 * math.sin(i * math.pi / 32))
cols[1][i]= math.abs(128 - 127 * math.sin(i * math.pi/ 64))
cols[2][i]= math.abs(128 - 127 * math.sin(i * math.pi / 128))
end
for y = 1,480 do
for x =1,639 do
c = int((math.sin(x/35)*128+math.sin(y/28)*32 + math.sin((x+y)/16)*64))
if c >255 then
c = c - 256
end
if c < 0 then
c = 256 + c
end
r = cols[0][c]
if r > 255 then
r = r - 256
end
if r < 0 then
r = 256 + c
end
g = cols[1][c]
if g >255 then
g = g - 256
end
if g < 0 then
g = 256 + c
end
b = cols[2][c]
if b>255 then
b = b - 256
end
if b < 0 then
b = 256 + c
end
ink ( hrgb (r, g, b))
pset (x, y)
end
end
ink (hrgb (0,200,200))
locate (0,30,"")
--- End code ---
And lorenz.lua (from bp.org):
--- Code: ---paper (0)
cls()
x=0
y=20
z=20
count=0
tick = gettickcount()
while not keypressed() do
xx = x + 0.01 * ( -10.0 * x + 10.0 * y)
yy = y + 0.01 * ( 28.0 * x - y - x * z )
zz = z + 0.01 * ( -8.0 * z / 3.0 + x * y )
ink (hrgb(int(rnd()*255),int(rnd()*255),int(rnd()*255)))
line (x*10+320, -z*10+500, xx*10+320, -zz*10+500)
x = xx
y = yy
z = zz
count = count + 1
if count>=20000 then
break
end
end
tack = gettickcount()
tock = (tack-tick)/1000
ink (hrgb (255,255,255))
locate (0,30,"")
print ("TIME: ".. tock .. " SECONDS")
print (count.. " LINES DRAWN")
--- End code ---
Cybermonkey:
I made a temporarily website out of the documentation: http://cmb.retrogamecoding.org/
Tomaaz:
There is one problem on Linux. Only exit() closes the program properly. When you try to close the window, it disappears, but ChipmonkeyLua is still running in the background. This is annoying when using external editor. After some time you may end with several ChipmonkeyLua processes running in the background and eating your memory and all you can do is kill them manually.
EDIT: Would it be possible to compile ChipmonkeyLua on Raspberry Pi?
Navigation
[0] Message Index
[#] Next page
Go to full version