News for hackers. Stuff that matters.
Re:Show HN: Meg-4, the Open Source PICO-8 alternative by schemescape on Saturday June 17, 2023 @03:31PM (#36373711)
That’s funny, I almost asked about TCC, but decided not to because I wasn’t sure it could be easily adapted to your custom VM :)

For Lua and file system access, is that only with the standard library? If not, that would be very surprising!

Re:Show HN: Meg-4, the Open Source PICO-8 alternative by bzt on Saturday June 17, 2023 @07:13PM (#36375689)
> For Lua and file system access, is that only with the standard library? If not, that would be very surprising!

If by standard library you mean Lua's io package in baselib, then the answer is yes. For example, "dofile" or "loadfile" functions will work no matter baselib is removed or not.

Here's a full list if you're interested: https://gitlab.com/bztsrc/meg4/-/blob/main/src/lua/hardened....

In a nutshell, I've removed package, coroutine, io, os modules from baselib and all functions calling fopen or fread/fwrite (like "loadfile") and replaced these with the MEG-4 API. This way you have the same functions in Lua as in C. All the rest left untouched; eg. table, string, utf8, math, etc. modules are still available as usual.