Skip to content
← Back to Community
Profile icon



Nelua is a language that I've wished after years making game engines in C/C++/Lua. It's my take on making a language that is compiled, efficient and simple with Lua syntax and semantics. It compiles first to C then to native code. You could think of it as a "better C" with a Lua syntax/goodies and type notations, but it's much more. Nelua is influenced by Nim, Odin and Zig languages, all of them tries to be a "better C", so does Nelua, but with a Lua flavor.

Quick Example

-- Calculates the factorial of a number. local function factorial(n: integer): integer if n == 0 then return 1 else return n * factorial(n - 1) end end local n = 5 local res = factorial(n) print(n, 'factorial is', res)

This program will print the factorial of 5.

About it

In short Nelua is a minimal, simple, efficient, statically typed, compiled, meta programmable, safe and extensible systems programming language with a Lua flavor. It uses ahead of time compilation to compile to native code. Nelua stands for Native Extensible Lua.

For more details check the website and the GitHub page, give a star if you find it interesting!
To get an overview of the language syntax and features by example, check the overview page.

Try it in

You can try Nelua on the here.
There are many examples in the examples and tests folder that you can run like nelua examples/condots.nelua (this one is graphical and it will open X11) inside

To learn about the language features the examples/overview.nelua is the most interesting to run and you can follow it along the overview page.

Complete Examples

Here are some small games made in pure Nelua, all of them you can play in the browser and check the sources! - Tetris game - Clone of 2048 game - Castle Game - play here

Some other interesting stuff: - Raylib Bindings - Profiler for Raylib - Ray Tracer


Nelua compiler is made in pure Lua, and consists in 4 passes:

  1. Use LPEG for parsing all the syntax into an AST
  2. Analyze the AST for checking and inferring types
  3. Generate C code using the analyzed AST
  4. Compile the C code using a C compiler such as GCC/Clang

You will notice some C code in the repository but that's because I've bundled Lua 5.4 interpreter with needed extensions to make easy to install Nelua on REPL or any machine.

One thing interesting about Nelua is that it has a Lua preprocessor with powerful meta programming capabilities that gives full access to the compiler itself while it's compiling and assists specializing efficient static code.


The nelua team:
- Author of the Language
- Tester, making libraries and games with it

NOTE: I've been making this language for more than one year, although I've been very active the whole month developing this language and polishing some stuff for the JAM.

Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon
Profile icon