r/lua • u/Unhappy_Ship_1997 • Jun 01 '26
Project || Working on an Terminal Based Game in Lua ||
Started Working on an Terminal Based Game Engine in Lua yesterday!
r/lua • u/Unhappy_Ship_1997 • Jun 01 '26
Started Working on an Terminal Based Game Engine in Lua yesterday!
r/lua • u/classpert • Jul 26 '22
Roberto Ierusalimschy was interviewed by u/thequestionaskerer on June 27th
Why did you create Lua?
We created Lua because we needed that kind of language. We needed what we call a configuration language. We made it to solve problems. It was created almost 30 years ago in 1993. We had a project between our university, the Pontifical Catholic University here in Rio de Janeiro, and the Brazilian oil company (Petrobras). We needed that language to configure other applications. And at that time, the only other option would be Tcl, "tickle.â But we figured out that Tcl was not easy for nonprogrammers to use. And Lua, since the beginning, was designed for technical people, but not professional programmers only.In the beginning, the typical users of Lua, were civil engineers, geologists, people with some technical background, but not professional programmers. And "Tcl" was really, really difficult for a non-programmer. All those substitutions, all those notions, etc. So we decided to create a language because we actually needed it.
What were your primary design goals?
Well, one of the design goals, was for Lua to be easy for nonprogrammers to use and also to be portable because there were lots of governmental rules imposed on the Brazilian oil company about what it could or could not buy. Sometimes they weren't always allowed to choose the exact equipment they wanted to buy, so they had all kinds of computers, operating systems, etc. So portability, since the beginning, was a very important goal. The small size also, because they had some computers on the oil platforms, and at that time, those computers were very restricted; they had very little memory, some were just old models, etc. So small size and simplicity were two important goals in the beginning. I think that's part of my character to emphasize simplicity as much as possible.
How have those goals for Lua changed over time, if at all?
I think one goal that changed, not much, but changed a little, was performance. In the beginning, we didn't have that in mind at all, and as Lua was being used more, people started building larger programs in Lua, so performance became more of a goal. But otherwise, I think the other goals I mentioned are still very important. They are still what drives most of our design decisions : small size, portability and ease of use. Oh, and I forgot to mention, of course, a very important goal is scripting and the ability to cooperate with programs written in different languages easily.
As you designed Lua, what were the most challenging features to get right or the most complex ones to create in a way your initial users would accept.
I don't think we had that kind of problem because when we had something that was challenging, we just didn't put it into the language. In the beginning, we needed something very simple: you need the configuration language, and you need things to be simple. And after that basic stuff was working, we started adding features as we found good and interesting solutions. For instance, a good example is macros: weâve been planning to add macros to Lua for at least ten years, but we couldn't find a good way to implement that. So we just didn't. When we find things that are challenging, we don't put that in and wait for some inspiration. After some time, sometimes it comes, sometimes it doesn't.
So in your experience, what are the most common mistakes developers make in Lua?
Mostly for people that came from Python, but also other languages, is that they forget to use local for local variables and because of that, they are polluting the global space too much. What else? I think, sometimes they make mistakes in how they use tables. The famous one we call holes. This is a significant source of problems. Holes in tables are actually non-elements in lists, nil. So sometimes users think they are adding something to the table, but when they add nil, they actually didn't add anything, and sometimes they can get confused. It's something that it's more common in experiments, rather than in real programs, in which people try some very strange things, and then go crazy trying to figure out the results.
What was the first programming language you ever used?
My first programming language was Fortran. Actually WATFIV: it's a dialect of Fortran that we used at the university to learn to program. And finally, my second programming language was Z80, a machine code written with hexadecimal on the first microcomputer I ever used at the time we programmed directly with hexadecimal. At that time, I knew the whole set of instructions for the Z80.
In your opinion, what is the most surprising use of Lua you have seen such as factories, science, space, military, etc?
That is a hard question because Lua grew so much more than we expected in the beginning. So a lot of uses are kind of surprising to us, even in games. In the beginning, Lua was not planned for games. It was kind of a big surprise, but maybe an even bigger surprise is the use of Lua in malware. Lua is relatively common in malware, and it's a kind of mixed feeling, because of course malware is not a good thing, but at the same time, it's a testimony to the quality of the software. Those people really understand what they are doing. It's like if someone who is going to rob a bank had to choose some car to escape. I mean, they're going to choose a very good car to do that. You're probably not going to do an advertisement for the car saying this. In fact, they can do that. It's a good advertisement for a car, by the way
You mentioned gaming. So Lua is having a burst of popularity due to gaming, is there a plan to build on this popularity?
Not specifically, as we get a lot of requests from game developers some things in Lua evolved because of them. One instance is coroutines, and another is the way the garbage collector evolved. But there's nothing really specific we're doing to make Lua more appropriate for games.
Two-part question: What's next for Lua and where do you see it in five, 10, or 20 years?
What's next? We don't have anything specific in mind for now. We made some big changes for Lua 5.4. One is the new garbage collector, the generational garbage collector. The other is called deterministic finalization. I think those were big changes, so I think we still need some time for them to settle and to solve all the bugs. We still need to see how they are being used. And so for now, we don't have anything in mind. And for 5-10 years, I think anyone who answers things for 5-10 years is justâŠnever mind.
Do you have a personal style that you use when coding?
When I code in Lua? When I'm coding in Lua, no. I don't think so. I think that when I'm coding in Lua, it's for showing examples, usually. It's an example that other people will follow, so I try to avoid quirks.
So why did you make Lua in C instead of other languages?
That's a good question. Well, first we needed portability, as I said, so I think C was and still is the most portable thing we have and we actually use a very strict subset of... I think I became a really big expert in C. I read the whole specification, the ANSI specification of C to learn what is correct, what is not correct, and what compiler I should accept. Sometimes we avoid things even if the manual says it's correct because we know that some compilers do not agree with the manual. But then C, I think, was the only viable option at that time. C++ could have been an option, but not 30 years ago. One thing that we sacrificed for portability, and was a big decision at the time, was to avoid Kernighan and Ritchie C and to start using ISO C, ANSI C. At that time, that was a hard decision.
Okay, another one from Reddit. Why doesn't Lua have a built-in package manager like Node.js or Python?
I think this is outside our goals. Now we have LuaRocks. I think it's doing great and we recommend it to anyone. But providing a native package management system is really outside our goals. Again, It's difficult to do that with the kind of portability that Lua was designed for. Lua is widely deployed in coffee machines, watches, routers, keyboards and many different kinds of embedded systems. Providing a native package manager comes with additional overhead and complexity.
While the Lua.org website is simple and easy to use, are there any plans to modernize the site and make it more mobile-friendly?
We like that old style.
Do you have any thoughts on making multi-core capable?
Multi-core? Lua is multicore, but that's a big discussion weâve had several times. I don't believe in multi-threading for a language like Lua. I always say that in any language that you do a = a + 1 and you don't know the answerâŠwhat's going to happen with that simple instruction. It's something that should be reserved for experts. So you do that in C, and you have all kinds of bugs, and, I think the most challenging thing is to do multitasking programs in any language and so in Lua we have processes. We have several good libraries. We have LuaLanes, Luaproc, and several different libraries that you have multi-processing in Lua with message passing. And so you have multi-core, but it's not multi-threading; it's multi-processing.
So did you ever have a feature that your users didn't appreciate as much as you did? And then have to deprecate or remove them later?
No, because I think if we liked it, we kept it in spite of the usersâ opinion. We, of course, listen to what users say, but sometimes we still like the feature, and even if the users don't, we'll still keep it that way. We removed several features from Lua along the line, which was a big problem. In the past, each new version wasn't compatible with the previous one. Now we're being much more conservative than we were, but we still sometimes remove features, but we usually remove features that nobody uses, including us. We've tried to remove features that people will not miss much.
Outside of Lua. What languages do you like the best?
There are some languages that I think I would be very proud to have created. One is Scheme. I think one thing I value in languages is the elegance and the integrity of the design and I have always been a big fan of Scheme. Haskell is another language that I think is really very, very smart. There is another language that I like, and it's very, very strange, very, very old, and most people don't know it nowadays called SNOBOL. It was a language mostly based on pattern match. It's a very, very interesting language. And what else? Icon was kind of new at the time it appeared, and it was a different kind of SNOBOL, and one that I'm very interested in. Still, I must confess, I haven't had time to learn, but that seems to be very interesting now is Rust.
Where would you like to see Lua used more?
Mostly, I mean everywhere, but mostly the Internet of Things. Because Lua was created for that, it's really good for those kinds of uses in embedded systems. Sometimes people just don't use it because they don't know it. People should pay more attention to the strengths of Lua, being portable, being small, etc. Those are very good strengths for the Internet of Things.
What are your thoughts on a more compact function definition to make the most of Lua's fantastic functional programming capabilities?
We've thought about that, we've talked a lot about that. But that's like one of the things I mentioned earlier; sometimes we cannot come up with anything that is good enough, because most short definitions do not allow statements. The typical short thing is like the implicit return so you only have one expression inside the function and I think Lua is too imperative for that kind of restriction. Lambdas, as they call it, should be restricted to only one single expression inside it. So from time to time, we think about it. There are some nice proposals already on the web, but we cannot find anything that really satisfies our goals. So we have some mixed feelings about it.
So what are your thoughts on WebAssembly? And how it may compete with the embedded language space?
I don't think WebAssembly will compete with Lua at all; quite the contrary. WebAssembly would be a nice target for Lua. For instance, we could make something practical to have some implementation of Lua that generates WebAssembly, but I see WebAssembly much more like a virtual machine than as a real language. Most people will not program WebAssembly as a programming language. Usually, they use some other language to generate WebAssembly. So I think that's more like a partner than a competitor.
When writing in a plain text editor with no formatting capabilities, which would you use, the first, second, third or fourth?
1) a=a+(1+b)/3
2) a = a+(1+b)/3
3) a = a + ( 1 + b ) / 3
,4) a = a + (1 + b) / 3
That's funny. In the past, I used to use #1. Lua's source code still has many expressions of code written like #1. Now I almost always write more like #4, the last option, but I'm not very consistent. Sometimes it depends on the environment, and it depends on what specific expressions are being used. For instance, in this specific example, I probably would lose the spaces around the division, and so, sometimes I prefer that format to emphasize that the division has a higher priority. But it depends. It's more or less like that. I never use spaces inside parentheses. That's like #3, I never ever wrote anything similar, #1 or #2 yes, but in the past, I used #1 or #2 much more often. Now I tend to write like #4. Sometimes as I said, we move spaces just to emphasize some priorities.
MicroPython is now on Casio calculators; what would it take to see a calculator with a MicroPython style IDE for Lua?
I must confess, I have no idea what is inside a Casio calculator. So I don't know what it would take. I don't know how much memory it has, but usually, Lua sits in very small devices, so it has some reasonable thing inside a Casio. I think it would be hard to put Lua inside that, but then I must confess that I have no idea how much memory it has. I think memory is usually the main problem for Lua. I mean, you must have at least some 300 kilobytes or 500 kilobytes, it's good enough, but some machines have like 10s of kilobytes, then Lua would not be a good fit.
What would it take for Lua to get a release with some sort of official stamp that could compete directly with languages like Go? I.e. a standard library like that in Luvit, possibly LuaLanes style threading, and UIP support for UIs in all platforms. Currently, I'm thinking that if a company does all the above, we may get another LuaJIT style split where the community gets "stuck" with some version of Lua while lua.org keeps adding features to another version with no cooperation between the developers of the two versions.
I don't think that's a danger at all. I don't understand why that would be a danger because all that stuff would be libraries. I think it's very clear; that's the whole point of Lua, we have a very clear division between the library and the language. So, for us, it would be very nice. Now we have the community around LuaRocks, I think it's working quite nicely, and it's a completely different group from us. I know Misham of course, but we hardly cooperate formally, and I think it's working quite well. So I don't think about that kind of problem. LuaJit was a completely different thing because he started working on the language itself; he never worked on libraries or anything like that to cooperate with Lua. From the beginning, it has been an alternative to Lua. So, I don't think that comparison is valid here.
What do you think about all the transpilers to Lua that are popping up? like Teal and Moonscript and so on? Should Lua aim to be more transpiler friendly?
We think about that from time to time. I think the only thing that's really missing in Lua to be more transpiler friendly, would be some way to⊠I don't know the technical name for that. You can say in a source file, consider that this line is from another line or from another file. So we have proper error messages, for instance. So we, like in C, have that line directive or file directive that you can put in, say "pretend this is line something in your file." So Lua doesn't have that, but I think apart from that, Lua is quite nice for transpilers. I mean, it's format free, so it's very easy to generate code. It has extra facilities; for instance, in some lists, you can have an extra comma, which is very silly, but it's really easy to add an extra comma after a list of things in the tables. So I think it's more or less transpiler friendly, but I don't see many people asking for that, so we never think much about that. But I think we have another thing that's very good for transparency. It is the hex annotation for floating point numbers so that we can have precision for your numbers when you generate the code. So again, I think Lua has some capabilities to be transpiler friendly, and I'd like to hear more. I like this idea.
Why can't you and Mike Pall work together in a single runtime?
I have never even met Mike Pall, so it's a little hard to work together with someone who I've never met. So I think that's just the beginning of the answer.
What is your reasoning behind making variables non-local by default?
This is a very funny question, because if you think about any programming language, but Python, they are all kind of non-local by default. For instance, if you see a function in C, you don't see the whole code, because there are a lot of 'includes' there. So you see one function, and if a variable is not declared in the function, it is global by default. That's what happens in C; that's what happens in Java. That's what happens in a lot of programming languages. So I think it's funny that people learn Python and then come to Lua and say "Oh, Lua is non-local" and think we invented that, that it was something completely radical. And there are so many wrong things with local by default because you cannot define the scope you want the variable to be. It's very common. For instance, you have a variable that you must initialize inside a 'then' or an 'else' in an 'if,' so if it's local by block, it would be restricted to the block inside the 'if' so otherwise you only have locals and in the function scope, which is not good, too. So it's much nicer to have local. You can have a local that is really local to the block where you need it. The standard in programming languages is not local by default. So Python created that slice for some very small things, but for anything more complex, you start to get problems around that. I can understand the question and it's reasonable to ask why do we have non-local as default, that is not to accept undeclared variables and all variables should be declared. Having the option of local by default, for me, is something very strange.
Why does the local keyword have to be 5 symbols long? In big programs, it often gets tiresome to declare variables. Why couldn't it be, say, let, or var, or my?
It could be; there is no specific reason I think we didn't think about that at the time. I mean, I don't mind typing five symbols, but I agree. Well, my is very, very strange I must say. it came from Perl, I think. But let or var, I liked those, it could have been different, but I don't think it's worth changing.
How many programming languages are you proficient in? And how many do you use on a regular basis?
I think I'm a real expert in C, ANSI C. I have been using Haskell regularly for teaching. Another language that I'm using that I became proficient in and I'm using a lot in my academic work is Coq, a language for theory improvement, although I'm not sure if it counts as a programming language. I was proficient in a lot of different languages in the past, but then you stop using them. For instance, I started my life as a programmer working in Fortran IV. I earned money for my first motorbike, working in Fortran IV many, many years ago. I worked in assembly language. I did some real stuff in assembly for the 8086, the first 16-bit architecture from Intel. I worked in Pascal. I did a lot of programs mostly in Turbo PASCAL. But now mostly I am working in C, Lua, Coq and Haskell. Those are my current languages.
What do you want your students to get from your Building a Programming Language course at Classpert?
This course gives a deeper understanding of how a language is developed, and how a language works from the inside. The course has an important practical side that is to enable the students to create a Domain Specific Language. And the students will also learn Lua, which is a very interesting and fun language, and Lpeg, which is a very powerful tool for syntactic analysis.
r/lua • u/epicfilemcnulty • Feb 16 '26
Hey folks, I've been working on this project for the last 4 years, and I think it's ready for the first beta release.
Mind you, I'm pretty sure there are still lots of bugs, and lots of features are not yet implemented, but I think it's quite usable. And at this stage I'd really use some feedback.
Caveat: Linux only.
It's a statically compiled LuaJIT with a bunch of builtin libs and modules + Linux shell.
When running as a shell it has different modes:
[F1] The shell itself
[F2] Lua REPL
[F3] Agent Smith -- minimal coding agent TUI
You can write and add your own modes
Here is the landing page, the repo is hosted at Codeberg. I've even created a dedicated subreddit, and it's absolutely beautiful in its emptiness :)
Screenshot shows the builtin markdown renderer/pager(best viewed in Kitty terminal, as it supports text-sizing).
Anyway, if anyone finds this interesting, I'd be glad to provide more info/answer questions. Contributions are also welcome.
r/lua • u/Landon_Hughes • Jun 16 '24
I've been bored with programming for a while now. Nothing really seemed "fun" for the longest time. I've used Swift (great language), Kotlin (for work), Python/Django (for work), C#, Java, and JavaScript. I've been trying to think of projects I can build in those languages...I've been pretty uninspired lately.
That said, just this past week I was looking at languages I haven't used before and I stumbled upon the framework Love2D & noticed it uses Lua...
What a great language!
I've only been using it for a few days now and it feels so refreshing. I love that there's only 1 data structure (tables)! I also love how customizable the language is! If I want to use "classes", I can create my own. Metamethods & metatables also feel very powerful.
The language feels pretty straightforward (so far) and I can totally get behind the syntax.
That's all. Thanks for reading!
Happy coding! :)
r/lua • u/zenith391 • Mar 16 '20
r/lua • u/my_thic_horse • Mar 08 '26
Sorry for not adding flair idk if this counts as help or discussion.
But anyways I just finished gr12 comp sci (we did java) and i thought itâd be good to try to start learning another language on my own before uni.
Is Lua primarily used for games? And for those of you with jobs in the field, do you use Lua at work?
r/lua • u/[deleted] • Nov 11 '20
https://github.com/dlannan/ljos
Im working on building a Luajit based OS. Hence the name. Currently, it happily runs in qemu, and will also boot on my laptop and run as well (from a USB). It is an "in-memory" single user mode kernel at the moment (this will change).
It uses some excellent packages like Luajit, ljsyscall, FBGraphics, kilo, lummander, sdl2, cairo and more. I am currently working on the graphical side of things and getting sdl2 and cairo to operate without issue, as well as integrating my old UI that uses cairo.
Happy to get feedback, suggestions and ideas. Note: This is a "barebones" OS, the full OS will be based around a new style of UI system called mitree.


r/lua • u/No-Bedroom-7821 • Oct 09 '26
Iâve been on Roblox for about 11 years but Iâve just now started getting into development on Roblox and Iâm really enjoying it!!!!
r/lua • u/youngzhuge • Dec 21 '24
Hello everyone,
2024 is coming to an end and I'm quite curious about this, what is the current state of Luain 2025? On the website of Lua, I feel like there's not much of an update. When I search Lua 2024 on Google, the result seems to stop at 2023. There are not many discussions, jobs for Lua also seem to be no result too. So I wonder, what is Lua going to be like in 2025?
The question seems to be vague, I hope you can understand as English is not my first language.
r/lua • u/peakygrinder089 • Sep 02 '24
r/lua • u/FelipeMarcelino • May 14 '20
r/lua • u/sergsoares • Mar 18 '25
Hey guys,
I miss a straightforward playground for Lua (Like Golang playground) that doesn't need to be the most updated, but I that allows me to start coding without login requirements and that saves my preferences.
The idea is to save boring meetings where you want to play with tables or code ideas, it is based on lua.vm.js (Lua 5.2.4) to allow it to be easy to host on the client side.
Local features:
- Persist code/output during reloads with indexedDB
- Ctrl or CMD + enter to execute code
- Font size
- Share code
- Dark/Light Mode
- Start/Stop execution
- Web Worker for avoid freeze main thread
o/
r/lua • u/Old_Sand7831 • Nov 10 '25
Luaâs simple but powerful what part do you miss elsewhere?
r/lua • u/aurelianspodarec • Feb 01 '25
Hi there!
Back in 2022, I was doing some game modding and found it very hard and slow to reference Lua for programming.
So I decided to create proper documentation following MDN sytle: The ones created from the manual itself, but in a modern format: https://www.luadocs.com/docs/introduction
I come from JavaScript, and I never had to learn Lua - I just knew it, but I always kept forgetting how to use stuff or what functions even existed.
The documentation isn't finished, but if anyone wants to help, or if there's interest I'll be up for finishing it off.
Got plenty of ideas, but want to see if anyones interested in this, if yes I'll continue it for the community and get it into a solid state but I want to see if it'll be of interest to anyone, as I no longer use Lua.
EEDIT1:
If you want to contribute feel free to make a pull request, you can find the MD/MDX files here: https://github.com/AurelianSpodarec/LuaDocs/tree/main/src/app/docs/functions
Its just the functions for now, slowly we can expand into other things, and overtime add other versions but for now best to figure out a format for the documentatoin, get the docs for 5.4 the basic functions and sowly iterate overtime so it gets actually done - otherwise it'll be too big to manage or do, espeacilly since it was just me right now.
EDIT2:
The documentation is very draft, so there is no "final say" in anything here. The idea is to get the content first, as that is the most important to every deloper.
After that, we can get something different thana NExtJS build, add better desing, whatever that is.
But the biggest value is in the documentation itself, the content. One that's in, we can always think of how to further improve it, but if we don't have content it doens't matter how good the site is. That's how I look at it at least.
So any feedback, any ideas, any content PR are appriciated.
Link: http://cds.cern.ch/record/2157242?ln=de
This lecture is from 2016 but as it seems it has not been posted on reddit so far. For everyone curious how fast LuaJIT is compared to C++, PyPy 4, NumPy, Python and Julia, go to slides 12 to 17 of the lecture by Laurent Deniau, CERN, who implemented and compared scientific algorithms in these technologies and describes the results. LuaJIT is incredibly fast compared to all others.
E.g. on slide 14: LuaJIT took 5.3 sec, C++/GCC 5.7 sec, PyPy 7.6 sec, Julia 35 sec and Python > 2 hours.
On slide 17 he has even examples where LuaJIT is three times as fast as C++ and up to 26 times as fast as PyPy + NumPy.
That's just amazing. No wonder CERN decided in favour of LuaJIT for the project.
r/lua • u/[deleted] • Oct 28 '24
For my Iâve just took some notes
r/lua • u/Jimmy-M-420 • May 16 '21
Here's a 2d game engine i've been working on for zelda-esque top down RPGs.
The engine is written in C++ and it uses OpenGL for rendering, GLFW for window instantiation and input.
It can load json files generated by "tiled".
All gameplay related code is written in Lua, which is integrated into the C++ code via the standard lua C api. See "scripts" folder for the general form of these scripts.
to write a script for a game object you just make a lua file with a table called GameObject which includes the methods init and update. Look in GameObject.cpp for the full list of C functions exposed to lua
The main loop, rendering, file io and collision detection happen in C++ - and all gameplay specific code in lua. A single lua VM is used for all scripted game objects and i think a second one (with different C functions exposed) will be used to script the games UI.
Here is the code for it so far - I hope some of you will find it useful and / or informative for your own projects :)
r/lua • u/WuTangTan • Jul 31 '15
r/lua • u/skydoi2 • Feb 06 '26
yea it has downsides but you can just implement it into C for example for low level power. so i dont get all the hate
-EDIT
not in this sub