New project

"An extremely naïve, brutalist attempt at packaging up simple Lua (5.1) apps with all the stuff needed to edit and build them."

Fun with the kids on a Saturday morning messing around with daddy's new program.

We gave each ring its own color, and we have it set up to move the towers randomly around after every move. Supremely silly.

You knew this was coming. Conway's Game of Life in text mode using Unicode Braille glyphs.

git clone
cd teliva
make linux
src/teliva life.teliva


@akkartik I love the idea behind this; nice work.

I am super curious about the decision to use a version of Lua that dates from 2006 though; even 5.2 fixes almost all of the most glaring flaws in 5.1 without having the higher LOC count of the latest version.

@technomancy Yeah, totally. I'm not really sure what I'm doing there, and might change this. My reasoning at the moment was:

- preserve the luajit option
- go with a smaller implantation if it's still widely used (thanks to luajit)

I'd love to be corrected on either score.

@akkartik I see, yeah. unfortunately those two goals are somewhat at odds with each other; if you prioritize speed you have to sacrifice size.

despite being compatible with 5.1, luajit fixes almost all the big flaws in it, though some of its fixes need to be specifically opted into at compile time.

IMO either switching to luajit or a newer PUC would be better than staying on PUC 5.1 but I can understand wanting to keep options open.

@technomancy That's really helpful. I'm going to keep an eye out for flaws since I haven't experienced them myself yet. Is there a definitive list somewhere?

I plan to write lots of Lua code over the next few weeks and months, so I'm sure I'll run into them for myself.

@akkartik the biggest problems are the inability for coroutines to yield across protected calls or C code boundaries and the inability to construct proxy tables (using metamethods) that can be iterated.

these are both issues which beginners are unlikely to hit on their own, but coroutines and metamethods are both pretty important as means of abstractions for using 3rd-party code. if your goals don't involve users pulling in libraries, maybe it's less of an issue.

@akkartik this doesn't work for libraries but if you control the final environment you can more or less fix the metamethod problem completely in userspace:

it's very ugly but it gets the job done. I used this in my game Bussard to implement read-only tables being exposed to the in-game sandbox which allows users to run whatever code they write while playing.

now that I think about it, a similar approach could work for teliva.


@technomancy @akkartik Also worth noting for those metamethods, if you're already working from C, is the native patch approach as seen in the Lua wiki

Though in the case of __ipairs you get the extra confusion of the fact that Lua 5.3 went on to deprecate it and 5.4 to remove it in favor of making ipairs respect __index and __len :(

@technomancy @akkartik Correction: ipairs respects __index and stops when it hits a nil, it doesn't check __len.

Not sure what I conflated it to throw __len in when I misremembered but figured I should correct myself after @technomancy asked me about it!

Sign in to participate in the conversation
Functional Café

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!