Lua Libraries for crazy bootable devember challenge

For Devember I’m going to work on polishing some of my Lua libraries.
Keep in mind that these are all not really production-quality code, and I want to improve that. Feedback is very welcome(especially from someone who is better at C than I am), so is any help(even documentation, spelling mistakes, etc.). Really, I’m just bored, so feel free to ask anything.
My libraries are all on Github, under the MIT license:

A bit of backstory…

The idea is mostly to get the lua-db[1] library ready for some real applications. It’s a small graphics library(db means drawbuffer, not database) implemented in C and Lua. I have programmed a game in it before, but I wanted to improve the code base a bit to make it more convenient and work on some of the “weak points” I’ve noticed: this game[2] was made for the Linux game Jam(From The Linux Gamer Gardiner), and was a minimal buildroot-based bootable linux kernel+initramfs running a small platformer game on the framebuffer(Yeah, I submitted a Linux to the Linux game jam, and it was only 15MB!). It had a lot of ugliness, but it worked(see some youtube video[3][4]) and was lots of fun making. I’d like to do that again, but with a game that is more… say, sanely programmed[5] and less… raw. It would also be cool if it could boot a graphical desktop. I’ve implemented something like this before[6], but it would go great on a bootable game/distro/hacky demo. Since the Linux game Jam, I’ve also manager to implement a read software 3D rendering “engine”[7], so maybe it could be a 3D game. Ideally, that bootable demo would be finished, or at least work mostly. I get that this is a strange combination of things, but it worked before ™.


The plan

Polish my Lua libraries, then implement a crazy bootable demo.
I’ve written a TODO-list of what I plan to do for Devember. I hope I can get at least some of the things actually done. I should be able to get something bootable, the question is the bodge factor. Wish me luck.


  • lua-db
    • This is my Lua graphics library and my primary focus. It’s CPU-only, and is written in Lua and C.
    • Improve documentation. Currently, only basic functionality is mostly documented
    • Update and improve bitmap reading(also update lua-bitmap)
    • Implement a Lua only FFI version of the base library, increasing the performance for some workloads significantly.
    • Create some benchmarks for the basic functionallity. Currently, only the multithreaded pixel functions have a benchmark.
    • Overhaul the input_output system
      • Implement a “unified event interface”, that is capable of translating various input event types to another. Specifically getch to SDL, linux input to SDL, and SDL to getch. Better decouple the input from the output systems.
      • Re-Implement the Linux framebuffer output backend. (was implemented in a previous version)
      • Re-Implement the terminal output backend. (also implemented in a previous version)
      • properly handle mouse events
      • Implement a “window manager” for input_output based applications
        • Can this be done usefully with only coroutines, or are thread required?
  • If all goes to plan, I should be able to write an application that could run the same on all useful combinations of input and output systems:
    • Output using SDL, input using SDL
    • Output using Linux framebuffer, input using getch translated to SDL
    • Output using Linux framebuffer, input using Linux input translated to SDL
    • Output using an ANSI Terminal, input using an ANSI terminal
  • lua-getch(required for the terminal input in the input_output system)
    • This is my Lua wrapper library for getting a character from a terminal in raw mode.
    • Publish the editor to git
    • Finish implementing the editor, document it.
    • Implement a basic terminal multiplexer example using getch. (Demonstrate using the get_mbs function to resolve some basic escape sequences using functions)
  • lua-input(required for input in the input_output system)
    • Finish the work undone work on the v2 examples:
      • Implement an example mouse/keyboard sharing application using these libraries.

This seems like a lot, and it may be, but a lot of that is just glue logic and finishing up partial and/or old implementations.


Nice. My only experience with Lua is game engine scripts with SDL2 lol. That and AwesomeWM.

Good luck! Looks like a really exciting project. I’ll be following your progress

1 Like

I figured I might as well make my first status report.

So, I’ve been mostly working on terminal handling. That inludes working on lua-getch. So I’ve actually commited my editor example, and figured I’d make a Video(since it’s kinda cool). I’ve also commited a lot of staging code to the various github repos.

As you can see, it’s buggy and unfinished. There is still a lot to do, the editor code is kind of ugly. I want to rewrite it using the terminal_buffer.(for future UTF-8 handling, easier rendering to non-terminals etc.).

BUT I’ve got other, more pressing things to do:
After I finish the input_output implementation of the terminal backend(the editor was a test platform for this), my next target would be
the framebuffer backend. For this, I will most likely need to finish lua-input first - it still needs some tests.

(I hope this sloppily made post and video is fine, I’m neither a native speaker nor really motivated to write an essay at 3:48 AM in the night.)


I’m still working on the projects… I’ve also decided to start to write a small guide for buildroot. It’s currently on my github:
I’d be glad if anyone proof-reads it. I’m not a native speaker, and in general I’ve never written any guides etc. Also, I’m quite aware that it currently requires some previous knowledge. I’m planning on fixing that.

It also contains another side-project… I should maybe not start more, but it’s so fun…

If you want to try it out(might be broken), just run


in the buildroot-2020.08.1 directory.
This should start to build the complete buildroot system(Takes ~20min).
You can then start the emulator using

1 Like