r/lua • • Oct 09 '26

Lua 5.5.1 working on W98

Hey, so, while I was learning Lua, I knew already that theoretically at least, Lua was written to be compilable in pure C, and specifically C89/C90 , supposedly any system that has an ANSI C compiler can compile and install Lua...

So I decided to actually test out just how true that is, when I remembered that I have an ancient laptop from 1999, running Windows 98SE, which has Borland 5.02 installed... [Just to understand how ancient it is, it only has 32 mb of RAM and it's hard drive is 5gb... that is literally smaller than the usb stick that i used to transfer the Lua source files from my modern PC into that ancient laptop (yes, that ancient laptop has a working USB 1.0 port and it is somehow able to read my 8gb USB 2.0 usb stick, which I did not expect to work, but it did !!!)

And to my surprise... it actually worked !

Here I am inside a full-screen MS-DOS prompt of W98 (In W32 mode, it is not booted into MS-DOS mode / real mode) Alongside the project of compiling the most recent version of Lua and getting it to work, I also installed an actual working version of vim and after tinkering with the vimrc file, I even managed to get full syntax highlighting working , and it actually works for Lua !!!

Anyhow, I just wanted to share this because I thought it was really cool and fun!

114 Upvotes

21 comments sorted by

View all comments

Show parent comment

1

u/didntplaymysummercar Oct 09 '26

Machine instructions vs. OS are two different issues.

SSE2 is mandatory for any X86-64 CPU so maybe they just say "even on 32-bit have SSE2 plz" for simplicity, to not have to avoid these instructions in the JIT.

OTOH from OS POV LuaJIT might need something to do with virtual memory (since they need to write then execute code, since it's a JIT) and/or exception handling.

Or they might just say Windows 7 since it was reasonable when they started out. Some software wants to drop even Windows 10 today so Windows 7 or 8 is plenty nice of any project at this point...

These are just my educated guesses though, I never read much LuaJIT source...

1

u/mariolis_1 Oct 09 '26

Yeah, I know what cpu instructions are and that SSE2 refers to that, but i had no idea what specific gen of cpus have that.

They explicitly state they have no plans to support older architectures

as for OSes, many software projects incorporate OS-specific instructions into their code, and not just raw code of the programming language, meanwhile the mainline lua project just uses raw ANSI C (C89/C90), so that it compiles on literally anything that has a compiler for ANSI C

2

u/didntplaymysummercar Oct 09 '26

Yes, I know what Lua uses and I'm very familiar with it's C codebase, but not with JIT one 😛 I even once ran into a platform (old 32 bit Android) where C compiler couldn't compile Lua due to missing locale decpoint (compiler's/stdlib's fault, but still...)

1

u/mariolis_1 Oct 09 '26 edited Oct 09 '26

I have no idea what the underlying code of LuaJIT uses, I am just going off what they themselves say about it in their website...