Lua Carousel: a programming environment for computers and mobile devices

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Kartik Agaram
Prole
Posts: 34
Joined: Fri Apr 01, 2022 4:46 am

Lua Carousel: a programming environment for computers and mobile devices

Post by Kartik Agaram »

It's nowhere near done yet, but I just published my new project, Lua Carousel, a lightweight cross-platform environment for creating small Lua and LÖVE programs. It's been tested across a wide variety of screen sizes on Windows, Linux, Mac, iOS and Android. On Windows, Linux and Mac you can also edit its sources live while it runs.

One major sharp edge: it doesn't save your programs yet, so they won't be restored after restart.

https://akkartik.itch.io/carousel
lua-carousel.png
lua-carousel.png (96.02 KiB) Viewed 46163 times
Source code: https://git.sr.ht/~akkartik/carousel.love

Comments most appreciated, thank you.
User avatar
BrotSagtMist
Party member
Posts: 659
Joined: Fri Aug 06, 2021 10:30 pm

Re: Lua Carousel: a programming environment for computers and mobile devices

Post by BrotSagtMist »

Not bad at all.
But why is it wasting so much space on the right?

Bugs i encountered: I cannot type any symbols, =()[] etc are ignored. I do have a non standard keyboard but these are properly send by texintput() and should just work.
Changing the window size or font size leads to crashes.
obey
User avatar
Kartik Agaram
Prole
Posts: 34
Joined: Fri Apr 01, 2022 4:46 am

Re: Lua Carousel: a programming environment for computers and mobile devices

Post by Kartik Agaram »

Both those issues are unexpected indeed. I'm only looking for those keys in `love.textinput`, not `love.keypressed`. Though I've been watching out for reports from other keyboard layouts for some time: https://github.com/akkartik/lines.love/ ... ffcb979301

Can I ask what device + OS (+ keyboard layout) you're using?
User avatar
Kartik Agaram
Prole
Posts: 34
Joined: Fri Apr 01, 2022 4:46 am

Re: Lua Carousel: a programming environment for computers and mobile devices

Post by Kartik Agaram »

The space on the right is available for your programs, as my examples show :)

I'd appreciate alternative suggestions! My goals are to keep the text at a readable width (around 40em at most), and to support everything from phones to large monitors with something simple. The choice of editor width is currently:

Code: Select all

math.min(30*width('m'), Safe_width*2/3)
Safe_width comes from love.window.getSafeArea()
User avatar
BrotSagtMist
Party member
Posts: 659
Joined: Fri Aug 06, 2021 10:30 pm

Re: Lua Carousel: a programming environment for computers and mobile devices

Post by BrotSagtMist »

de_neo on debian.
= for example is composed of caps+f.
Your code seems to ignore textinput when caps is pressed, at least thats the only way i could explain the problem.
obey
User avatar
Kartik Agaram
Prole
Posts: 34
Joined: Fri Apr 01, 2022 4:46 am

Re: Lua Carousel: a programming environment for computers and mobile devices

Post by Kartik Agaram »

I'm not doing any strange checking of caps-lock. I _do_ check for some modifiers though at https://git.sr.ht/~akkartik/carousel.lo ... t.lua#L158. That's probably no good for a layout like this..

Do you know what modifier key LÖVE returns when you press caps lock in your setup. Here's a test program for your convenience:

Code: Select all

F = ''

function love.keypressed(key)
  F = key
end

function love.draw()
  love.graphics.print(F)
end
---

Also, could you please share the error messages and call stacks if any for the crashes?
User avatar
Kartik Agaram
Prole
Posts: 34
Joined: Fri Apr 01, 2022 4:46 am

Re: Lua Carousel: a programming environment for computers and mobile devices

Post by Kartik Agaram »

The reason for that logic: I want to handle shortcuts like ctrl+c to copy in `love.keypressed` without also inserting the printable character within `love.textinput`. I wonder if there's a better way to achieve that..
User avatar
BrotSagtMist
Party member
Posts: 659
Joined: Fri Aug 06, 2021 10:30 pm

Re: Lua Carousel: a programming environment for computers and mobile devices

Post by BrotSagtMist »

I have 6 modifier keys here and half of them is registered as alt, despite not being alt. The other return "unknown".
You are probably eating events on layout alt, you may need to change this to position alt.

I get

Code: Select all

Something is wrong. Sorry!

Error: text.lua:866: Text.offset returned nil; this is likely a failure to handle utf8
stack traceback:
	[C]: in function 'assert'
	text.lua:866: in function 'offset'
	text.lua:800: in function 'x_after'
	text.lua:782: in function 'nearest_pos_less_than'
	text.lua:137: in function 'populate_screen_line_starting_pos'
	text.lua:938: in function 'redraw_all'
	on.resize:7: in function 'resize'
	main.lua:153: in function <main.lua:149>
	app.lua:35: in function <app.lua:35>
	app.lua:174: in function <app.lua:165>
	[C]: in function 'xpcall'
	app.lua:193: in function <app.lua:192>
	[C]: in function 'xpcall'
	[love "boot.lua"]:370: in function <[love "boot.lua"]:337>

(Note: function names above don't include outer tables. So functions like on.draw might show up as just 'draw', etc.)

Options:
- press "ctrl+c" (without the quotes) to copy this message to your clipboard to send to me: ak@akkartik.com
- press any other key to retry, see if things start working again
- run driver.love to try to fix it yourself. As you do, feel free to ask me questions: ak@akkartik.com


This is error #4 in this session; things will probably not improve in this session. Please copy the message and send it to me: ak@akkartik.com.
When changing the font size and the char € is in the text. But that error is at least cought properly.

I get a 100% cpu usage freeze when i resize the window. No error message there.
obey
User avatar
BrotSagtMist
Party member
Posts: 659
Joined: Fri Aug 06, 2021 10:30 pm

Re: Lua Carousel: a programming environment for computers and mobile devices

Post by BrotSagtMist »

I do not handle events at all in my editor, Löve already skips text input on its own if crtl is pressed. So there is no reason to do a modifier check at all.
obey
User avatar
Kartik Agaram
Prole
Posts: 34
Joined: Fri Apr 01, 2022 4:46 am

Re: Lua Carousel: a programming environment for computers and mobile devices

Post by Kartik Agaram »

Thanks a lot for those details!
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 4 guests