Page 1 of 3

Lua Carousel: a programming environment for computers and mobile devices

Posted: Thu Nov 23, 2023 7:15 pm
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 32856 times
Source code: https://git.sr.ht/~akkartik/carousel.love

Comments most appreciated, thank you.

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

Posted: Fri Nov 24, 2023 4:51 am
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.

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

Posted: Fri Nov 24, 2023 5:55 am
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?

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

Posted: Fri Nov 24, 2023 6:02 am
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()

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

Posted: Fri Nov 24, 2023 6:15 am
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.

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

Posted: Fri Nov 24, 2023 7:42 am
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?

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

Posted: Fri Nov 24, 2023 7:53 am
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..

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

Posted: Fri Nov 24, 2023 8:08 am
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.

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

Posted: Fri Nov 24, 2023 8:12 am
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.

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

Posted: Fri Nov 24, 2023 4:26 pm
by Kartik Agaram
Thanks a lot for those details!