💾 Archived View for separateconcerns.com › 2022-10-10-localua-pallene.gmi captured on 2024-08-18 at 17:47:12. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-04-19)

-=-=-=-=-=-=-

Pallene support in localua

published 2022-10-10

Today I attended Lua Workshop, and Roberto Ierusalimschy's keynote was about Pallene [1], a language designed as a system counterpart to Lua in a scripting architecture. The language is a typed subset of Lua and can be used to replace C or as an interface between Lua and C. It is still a work in progress, there is no stable release yet.

Pallene works by accessing the internals of the Lua VM, so it requires a patched version of Lua [2]. I wanted to try it so I added support for it to localua [3]. You can just use "pallene" instead of the Lua version and it will pull the latest sources of Pallene and its Lua fork and install them in a self-contained directory.

The Pallene compiler does not have an easy way to specify a local Lua directory and I decided against hacking it so you will have to pass `CFLAGS` as an environment variable for it to work.

I have just pushed a localua version that supports this so you too can try Pallene now. Be aware that I have only tested this on Linux, and that it is an undocumented feature which means I do not guarantee I will support it forever. That being said, this works now:

curl "https://loadk.com/localua.sh" -O
chmod +x localua.sh
./localua.sh .lua pallene
curl -O "https://raw.githubusercontent.com/pallene-lang/pallene/master/examples/fibonacci/fibonacci.pln"
CFLAGS="-I $(pwd)/.lua/include -O2" ./.lua/bin/pallenec fibonacci.pln
./.lua/bin/lua -e 'print((require "fibonacci").fibonacci(10)[8])' # prints 13

1: https://github.com/pallene-lang/pallene

2: https://github.com/pallene-lang/lua-internals

3: https://loadk.com