New version after 4 months
Nothing particularly new here, just a dozen or so fairly minor tweaks and bugfixes. Perhaps the most noticeable one is that I swapped the position of the copy and paste buttons in the menu. I found myself fat-fingering the 'clear' button on my phone when I meant to 'paste'. Now I try to alternate buttons that don't modify the text with buttons that do, which provides a little more of a buffer for destructive changes. Still doesn't entirely eliminate fat-fingering; I'm tempted sometimes to add confirmation buttons.
Anyways, that hopefully gives you a sense for the scale of changes in this version.
While there's nothing major here, I've been streamlining the code behind the scenes, and enough of that sort of thing accumulated that I started feeling some pressure to put out a new version. So there's some chance I've introduced a regression in this release. Please let me know if you spot anything amiss.
Today's programs to play with are some silly variations on a theme I made a few weeks ago (inspired by a uxn program, IIRC).
Version 1
x, y = 512, 0 color(1,0,1, 0.2) repeat line(x,0, 0,y) x = x-8 y = y+8 until x <= 0

Version 2 (animated)
n = min(Safe_width, Safe_height-Menu_bottom)
x1, y1, x2, y2 = n, 0, 0, 0
d = 8
dx1, dy1, dx2, dy2 = -d, 0, 0, d
history = {}
nlines = 30
function car.draw()
color(1,0,1, 0.2)
for i=1,#history do
local x1, y1, x2, y2 = unpack(history[i])
line(x1,Menu_bottom+y1, x2,Menu_bottom+y2)
end
end
function car.update()
x1, y1, x2, y2 = x1+dx1, y1+dy1, x2+dx2, y2+dy2
table.insert(history, {x1, y1, x2, y2})
if #history > nlines then
table.remove(history, 1)
end
if x1 < 0 then
dx1, dy1, dx2, dy2 = 0, d, d, 0
x1, y2 = 0, n
elseif y1 > n then
dx1, dy1, dx2, dy2 = d, 0, 0, -d
x2, y1 = n, n
elseif x1 > n then
dx1, dy1, dx2, dy2 = 0, -d, -d, 0
x1, y2 = n, 0
elseif y1 < 0 then
dx1, dy1, dx2, dy2 = -d, 0, 0, d
x2, y1 = 0, 0
end
end
Version 3 (interactive)
widgets = {}
n = Safe_width
dx, dy = 8, 8
function dx_slider()
local x0,x1 = 104,228
local lo,hi = 4,128
local x = dx+100
local y, w,h = 86, 20,20
local selected = false
local draw = function()
color(0,0,1)
line(x0,y, x1,y)
rect('fill', x-w/2, y-h/2, w,h)
end
local ispress = function(x2,y2)
return x2 >= x-w/2 and x2 <= x+w/2 and y2 >= y-h/2 and y2 <= y+h/2
end
local press = function() selected = true end
local update = function(x2,y2)
if selected then
x = min(max(x2, x0), x1)
dx = x - 100
end
end
local release = function() selected = false end
return {draw=draw, ispress=ispress, press=press, update=update, release=release}
end
widgets.dx_slider = dx_slider()
function dy_slider()
local y0, y1 = 104, 228
local lo, hi = 4, 128
local y = dy + 100
local x, w,h = 86, 20,20
local selected = false
local draw = function()
color(0,0,1)
line(x,y0, x,y1)
rect('fill', x-w/2, y-h/2, w,h)
end
local ispress = function(x2,y2)
return x2 >= x-w/2 and x2 <= x+w/2 and y2 >= y-h/2 and y2 <= y+h/2
end
local press = function() selected = true end
local update = function(x2,y2)
if selected then
y = min(max(y2, y0), y1)
dy = y - 100
end
end
local release = function() selected = false end
return {draw=draw, ispress=ispress, press=press, update=update, release=release}
end
widgets.dy_slider = dy_slider()
function car.draw()
x, y = n, Menu_bottom
color(1,0,1, 0.2)
repeat
line(x,Menu_bottom, 0,y)
x = x - dx
y = y + dy
until x <= 0
for name,w in pairs(widgets) do
w.draw()
end
end
function car.mousepressed(x,y, b)
for name,w in pairs(widgets) do
if w.ispress(x,y) then
return w.press()
end
end
end
function car.update(dt)
for name,w in pairs(widgets) do
if w.update then w.update(App.mouse_x(), App.mouse_y()) end
end
end
function car.mousereleased(x,y, b)
for name,w in pairs(widgets) do
if w.release then w.release() end
end
end

If you try pasting any of these programs into Lua Carousel, remember to first run the abbreviations on one of the example screens. Or if you've deleted that screen, here are the abbreviations I used in this post:
g = love.graphics line = g.line rect = g.rectangle color = g.setColor min, max = math.min, math.max
Files
Get Lua Carousel
Lua Carousel
Write programs on desktop and mobile
| Status | In development |
| Category | Tool |
| Author | Kartik Agaram |
| Tags | LÖVE |
More posts
- Programming on your device with your preferred language75 days ago
- Lua Carousel: program on the device you have, with docs at your fingertipsMay 12, 2025
- Pong Wars, MMO editionFeb 16, 2025
- New version after 41 days, and stop-motion animationFeb 15, 2025
- Drawing with a pen on a pendulumJan 11, 2025
- New version after 16 daysJan 04, 2025
- New version after 9 daysDec 19, 2024
- New version after 3 daysNov 17, 2024
- New version after 40 daysNov 14, 2024
- Turn your phone or tablet into a chess clockNov 01, 2024

Leave a comment
Log in with itch.io to leave a comment.