logoalt Hacker News

JSR_FDEDtoday at 2:20 AM3 repliesview on HN

What’s the Lua/LuaJIT story these days for bundling up all the scripts of an application into a single file? Is there a way to do the super convenient go-like thing?


Replies

zdragnartoday at 3:30 AM

There's a bunch of options from a Google search, but embedding it in a thin C program and building that with https://github.com/jart/cosmopolitan would be a pretty go-like experience, I'd think.

gucci-on-fleektoday at 3:09 AM

I personally use a hand-written C wrapper program (which is not much more than a dozen lines long), and then embed the Lua scripts using objdump. This isn't quite as easy as Go since cross-compiling C programs is often somewhat tricky, but Lua is very portable and has zero dependencies, so it's usually not too hard.

orthoxeroxtoday at 7:31 AM

There was a Lua[JIT] fork called Idle that seems to have fallen off the face of the Earth that did exactly that: it would take a small stub program, a runtime library and all the scripts and package them into a single PE/COFF binary that would read itself when run.

Love2D does it as well: zip -9 -r SuperGame.love . cat love.exe SuperGame.love > SuperGame.exe

This doesn't work with ELF files, though.