About luac.nl

What's this all about?

Back :: @BGroothedde :: xoru.net

This website is merely a simple system that allows users to upload their Lua code and download Lua bytecode chunks in any official Lua version they want. Lua versions will be maintained and when requested, a custom build of Lua can be arranged (i.e. lua_Number = int, larger instructions, larger integers, whatever!)

There's a couple of more features, which I'll list on this page. Consider this the man page for luac.nl, however a little less conventional

Compile Lua to Bytecode

Chunks... chunks... chunks... x64 and strip debug!

First and foremost, this website was brought online to have a tool anywhere in the world that allows me to compile Lua scripts into bytecode for any Lua version I encounter. This is why the old Lua fossils are supported here as well. I've come across quite old Lua code here and there and whenever I can, I like to use bytecode.

You can strip the debug information in any Lua version that supports it. You can also compile using the x64 bit build of the chosen Lua version, but keep in mind that older Lua versions didn't always play nicely with x64 bit environments. The option is there, but use it wherever it is wise.

Compile bytecode to information

Get back some sweet information about something that was compiled long ago

Sometimes I find myself in a situation where I need to know what a certain precompiled chunk can do. It might be for debugging, it might be to start implementing it or even out of pure curiosity. This is why when you upload a Lua bytecode chunk (a .luac file) to luac.nl you can check the 'List Instructions' option and the 'lfile Tree' option. These options will attempt to produce useful information about the chunk, highlighted in colors.

luac -p -l -l

The 'List Instructions' option currently only supports Lua versions 4.0 and up, because the versions before this differ too much in my personal opinion. Lua 2 never had the -l option and Lua 3 produces a different output for each minor version. In the back-end, it uses luac undump features (luac -u or luac -p -l -l) to get an instruction list to present to you. The website parses the output and displays it with syntax highlighting. Aside from that, when you hover over instructions you can see their purpose.

lfile -vL100

The 'lfile Tree' option tries to generate a hierarchy about the uploaded bytecode for you. This tree contains all information about the Lua bytecode, with the exception of some debug information and without the code. lfile is a piece of software I am developing which, like the unix `file` command, tries to identify file types / mime types based on their content. Aside from identifying these files, a detection module can also fully dynamically investigate a file and produce a tree of information about the file.

luac.nl uses the Lua module in lfile, with verbosity level to its maximum (-v(erbose)L(evel)100). It will recurse through the bytecode and show you the hierarchy of all closures/prototypes.

Combine it all!

List lfile tree compile dump chunk chunk chunk

When you select a Lua script to upload, and select either or both of the 'List Instructions' and 'lfile Tree' options you will be presented the instruction listing for you source file and/or the lfile hierarchy tree for your source file. If you haven't stripped debug information, luac.nl will match the original source code with the instruction list and present you with the instructions being called for each specific line of code. note: this is line-based, meaning if your whole script would be on one line - it would be placed above all instructions once!


Social, suggestions

Please do note that this project is not my main project and mostly for convenience and fun. If, however, you have suggestions that could make this a powerful tool; hit me up!

Back :: @BGroothedde :: xoru.net