13 ms·
Lua 5.5
- artemonster 10mo agoplease resurrect Mike Pall
- thayne 10mo agoMike Pall made a commit to LuaJIT just a couple of weeks ago.
- rfl890 9mo agoHe only does bugfixes now; the project is essentially in "maintenance-mode".
- radiator 9mo agoBut he has been working actively on LuaJIT. According to [1], he has come to the conclusion that, instead of working on LuaJIT 2.2, it would be a better investment of his time to go big on v3.0 and rearchitect it. LuaJIT 2.1 is to be maintained. [1] https://www.freelists.org/post/luajit/Question-about-LuaJIT-v30-status,1 https://www.freelists.org/post/luajit/Question-about-LuaJIT-...
- andrewmcwatters 10mo agoInteresting, it looks like you can use ´global myvar’ now, as compared to ´myvar’ implicit globals, say from back in 5.1, or ´local myvar’. It’s worth noting that global is a reserved keyword now, so environments that had a ´global()´ function for escaping environments will now need to rename their helper function.
- darubedarob 10mo agoBut.. why ? Globals are just variables that reside in the wrapping env table that also contain the C functions. If a closures is a onion of table lookups out of the function context from local -> function scope -> global scope is simply the last lookup before a not found variable with nil is declared?
- andrewmcwatters 10mo agoModule exports with side effects, and setting environments doesn’t guarantee global access.
- gsck 10mo agoCannot wait for another version of Lua to sit unused basically everywhere. Truly is a shame, everything seems to have settled on 5.1 for the most part without ever being updated, or any intention of it being updated. Some really nice features post 5.1 I understand each version of Lua introduces breaking changes in the language, which isn't great as the language becomes fragmented (Or not really, once again 5.1 is pretty ubiquitous)
- ronsor 10mo agoThe real reason everyone settled on Lua 5.1 is because that's the version LuaJIT is compatible with, and most people are unwilling to give up the performance gains.
- Rochus 10mo agoAnd Luau.
- pull_my_finger 10mo ago5.1 (by way of LuaJIT) gets a lot of use, but to suggests no one uses the modern versions is just not true. Lua being an embedded language just takes the pressure away to upgrade. It's a feature, not a bug.
- BugsJustFindMe 10mo ago> everything seems to have settled on 5.1 Not exactly. LuaJIT has backported various hot features from 5.2 and 5.3 as long as they're unlikely to break 5.1 code.
- petcat 10mo agoI'm pretty sure that's only OpenResty's distribution of LuaJIT. I think the real LuaJIT is strictly 5.1
- reactordev 10mo agoNo, real LuaJIT has some features from 5.2 and 5.3 https://luajit.org/extensions.html https://luajit.org/extensions.html
- cturtle 10mo agoOne of the new features I found interesting, declarations for global variables, is buried in the reference manual. Here's a link to the section that discusses it: https://www.lua.org/manual/5.5/manual.html#2.2 https://www.lua.org/manual/5.5/manual.html#2.2
- deleted 10mo ago[deleted]
- rhelz 10mo agoWhy did you find this interesting?
- embedding-shape 10mo agoFor me it's interesting because global variable declarations haven't been needed before, so why now? Also, I'm not sure `global` was reserved before, but now it seems to be.
- TheCycoONE 9mo agolua does not preserve compatibility between minor versions. As such they don't need to reserve words for future use.
- mjmas 9mo agoThe point now is so that if you use a `global` statement in your code, Lua will now error on misspellings of local variables when compiling, rather than defaulting to treat them as globals.
- kevin_thibedeau 9mo agoIt indicates paving the path for local scoping in a future release where Lua 5 code is upgraded with global declarations to keep it working.
- NuclearPM 9mo ago
- parlortricks 10mo agoExcellent new release, now for Fennel and Love2d to update, fun times!
- derstander 10mo agoOnly a dabbler in Love2d here but I’d expect that update to be a bit down the line. If I’m not mistaken the current Love2d version 11.5 is (mostly) tied to Lua 5.1 because of LuaJIT, though I understand some later Lua features are backported. And the changelog for the in-dev 12.0 release talks about compiling Love2d for Lua 5.4 as if it’s an optional thing. I don’t really follow LuaJIT too closely so I’m not sure if they’re even targeting Lua 5.4 let alone 5.5. I remember reading some GitHub issue that suggested some of the design decisions in Lua 5.4 wouldn’t really support LuaJIT goals re: performance. With that said I’ve been enjoying Love2d even with Lua 5.1 features — as a hobbyist it works just fine for me. Would certainly appreciate any corrections by those more in-the-know though!
- nmz 9mo agoIt's best to say that its tied to luajit, because at this rate, luajit is its own mixture of lua features, which they backport from newer versions.
- gucci-on-fleek 10mo agoConTeXt has been using beta versions Lua 5.5 for a few years now, so you can look through its source [0] or try running it [1] if you're curious what a large codebase written in Lua 5.5 looks like. [0]: https://codeberg.org/contextgarden/context https://codeberg.org/contextgarden/context [1]: https://wiki.contextgarden.net/Introduction/Installation https://wiki.contextgarden.net/Introduction/Installation
- sunshine-o 10mo agoI never coded in Lua but I found out recently that Lua is now in FreeBSD base [0] This is huge for Lua and FreeBSD. Now something that worry me is whenever you need to make an HTTP request or parse some JSON you need to go on a quest for a "library" on the Internet. It doesn't seems to have a (semi-)official "Extended Standard Library" I can quickly trust. - [0] https://man.freebsd.org/cgi/man.cgi?query=flua&apropos=0&sektion=0&manpath=FreeBSD+15.0-RELEASE+and+Ports&arch=default&format=html https://man.freebsd.org/cgi/man.cgi?query=flua&apropos=0&sek...
- Fwirt 10mo agoThe Lua ecosystem is more like the Lisp ecosystem than Python. The language is small enough that there’s a lot of stuff out there that’s just… finished. Hasn’t been updated in 10 years but still works. The LunarModules org tries to gather it up and keep it compatible. For an extended standard lib, the closest thing is probably Penlight. https://github.com/lunarmodules/Penlight https://github.com/lunarmodules/Penlight If you want async IO, sockets, etc, check out Luvit. https://luvit.io https://luvit.io Lua is really designed as an extension language but it’s such a nifty little language that sometimes you really wish you could use it in place of Python or Perl, which is why LuaJIT is so popular. But LuaJIT is really just one guy’s project. Its metaprogramming features are really nice and let you build some Lisp-style DSLs, and if you want full Lisp syntax you can drop in Fennel. If you’re just writing extension code you often don’t need a standard lib because it’s easier just to roll your own function to fill the gap. Personally, I found it easier and quicker to just read the reference manual to learn the language. It’s small and simple enough that you shouldn’t have trouble getting up to speed if you have a couple other imperative languages under your belt. IMO metatables are much easier to work with than JavaScript’s prototype inheritance.
- nmz 9mo agoYou kind of always have to go on a quest for a library on the internet, why would lua be any different? For lua, luarocks is its module registry and you can sort by most downloads, which sometimes leads you to buggy modules, but what can you do.
- 9mo ago
- Kerrick 10mo agoWe never got a new edition of Programming in Lua for 5.4... does that mean we won't ever get one for 5.5?
- sigzero 10mo agoOh I hope that don't do that.
- RScholar 9mo agoThat's not true, it was published in 2016. I just happen to know because I bought it last week to support the Lua Foundation in the wake of doing some work on Scribunto modules at the Wikimedia projects. They're using Lua 5.1.5, but I figured the author would indicate the feature introduction points and I was correct about that. I'm only just over halfway through but if I'm being honest, I can't offer much praise for the depth of the material or the treatment it's given: other authoritative volumes I've previously consulted (strangely, Mastering CMake comes to mind first among that cohort) were much more effective at communicating the underlying philosophies of construction and other unobvious practical realities of their subjects. Nevertheless, I do still value having a comprehensive reference at hand to refresh my memory on what's in fact possible when working with a language that I make use of as infrequently as this one.
- Kerrick 9mo agoAccording to https://www.lua.org/pil/ https://www.lua.org/pil/ > Fourth edition > Programming in Lua > by Roberto Ierusalimschy > Lua.org, August 2016 > The fourth edition updates the book to Lua 5.3
- altairprime 10mo agoList of changes: https://lua.org/manual/5.5/readme.html#changes https://lua.org/manual/5.5/readme.html#changes
- maxpert 10mo agoI feel like Lua is absolutely underrated. I just wish one of the mainstream browsers actually puts their foot down and starts supporting Lua as scripting language.
- klysm 10mo agoCurious how this fits in with WASM
- 1313ed01 10mo agoIf they can lock it to some version to avoid breaking code every time there is a new Lua version. Or Lua stop making breaking changes.
- tormeh 10mo agoYpu could probably run it in wasm. Of course, without access to the DOM it won't go any further than anything else on wasm. The whole thing is nuts if you ask me. So much lost potential.
- NuclearPM 9mo agoWhat is nuts?
- NooneAtAll3 9mo agolost potential of wasm not being allowed access to dom
- enricotr 9mo agoMeans like "a crazy thing" in slang, I think.
- bigstrat2003 9mo agoThat is correct. Not sure about all dialects of English but in American English, "nuts" is a slang synonym for "insane". So to say "the whole thing is nuts" could be rephrased as "the situation is crazy".
- robofanatic 10mo agoHow hard is it to put a simple hello world example on the homepage.
- BanazirGalbasi 10mo agoBecause Lua's Hello World is just `print("hello, world")`, which looks a lot like Python and doesn't tell you much about actually using the language.
- robofanatic 10mo agoThe point is, it shouldn’t be too hard just to find an example and get a sense of the language.
- syhol 10mo agoLearn x in y is always my goto: https://learnxinyminutes.com/lua/ https://learnxinyminutes.com/lua/
- IshKebab 9mo agoSo put a slightly more informative hello world example then. Look at the Go homepage. Or Nim. (But not Rust sadly.)
- BanazirGalbasi 9mo agoRather than Hello World, I'd rather see something like a classic Fibonacci calculator with recursion. That way you see function definitions, variable typing, math operations (Lua doesn't have increment/decrement operators or augmented assignments), and even tail-call recursion if it's an option. Hello World is really only useful as an environment verification - do you have your machine set up so you can run the code, or are you missing something?
- IshKebab 9mo agoLook at the Go homepage. It has a variety of examples.
- ksymph 10mo ago> for-loop variables are read only Seems like an odd change, I wonder what the rationale is. Just making it clear to people new to the language that you can't adjust it mid-loop to change the loop count I guess?
- pvitz 10mo agoFrom the manual: The control variable in for loops is read only. If you need to change it, declare a local variable with the same name in the loop body. Also [0]: Roberto Ierusalimschy > So what's the rationale to make them constant now? Does it have performance > reasons? Yes. The old code does an implicit "local x = x" for all loops, in case you modify 'x'. With the new semantics, the code only does it when you ask for it. [0] https://groups.google.com/g/lua-l/c/SlAG5QfpTac https://groups.google.com/g/lua-l/c/SlAG5QfpTac
- GranPC 10mo agoIn previous versions, you could change it mid-loop. This apparently caused some unintuitive behavior when paired with generators (e.g. `for k, v in pairs(table)`). I haven't run into this myself, but it does make sense, and eliminating this footgun sounds like a good idea.
- ufo 10mo agoThat was already the case in previous versions of Lua. You could assign to the loop variable but the assignment would be overwritten in the next loop iteration. https://www.lua.org/manual/5.3/manual.html#3.3.5 https://www.lua.org/manual/5.3/manual.html#3.3.5 The loop count was fixed at the start of the loop. One of the reasons for this was performance. For loops behave differently if the step count is positive or negative, and it's a bit faster to compute that once, before the loop, than to repeat it every iteration.
- mysterEFrank 10mo agoOG torch strikes back?
- klaussilveira 10mo ago> declarations for global variables That's huge. I wish LuaJIT adopted this, or at least added a compile time flag to enable it.
- shmerl 10mo agoYeah, I wish someone would pick up LuaJIT development. From what I've heard it in practice isn't developed anymore and is stuck at Lua 5.1 still.
- dividuum 10mo agoNot true. It's getting a constant stream of bugfixes. It's also not "stuck" on Lua 5.1, but is deliberately not following Lua's path, except for some backports. There's also a recent post about how a LuaJIT 3 might work.
- shmerl 10mo agoOK, then I got some wrong info. If it's stuck at it deliberately, then it's worse. May be someone should fork it and bring it up to date with recent Lua versions. Why is this split needed?
- upofadown 10mo agoMy understanding is that there was a language fork after 5.1. One thing was a complete reworking of how math works. It used to be just floating point for everything but the new idea was to make it like Python 3. So most operations are float/integer with some weird exceptions. As with any language fork there will be some who stay and others who switch to the new thing. Often a fork will drive people away from a particular language as in my case.
- shmerl 10mo agoLanguage fork is unfortunate. Python situation isn't much of a fork really. Python 2 is basically EOL.
- bsimpson 9mo agoI recently happened into Balatro through a Game Pass trial. I fell deep down the rabbit hole of trying to get it to run on SteamOS. It's fascinating to see a commercial game whose source is easily read inside the application bundle, and all the modding opportunities it opens up. (It's written in Lua with LÖVE.) Balatro was one of the biggest games of last year, and I'm sure the tinkerability was a big catalyst to that - people porting it to obscure platforms and making mods to extend the game. It's also really cool to see how the game handles all the different ecosystems it exists in (Steam, Game Pass, Apple, Android, Nintendo Switch…). I've got a Nix derivation that ought to be able to run any version of the game in Linux. Now I just need to figure out why it crashes when opened in game mode. All this is way more effort than just spending the $10 to get it to run in Steam natively, but it's more interesting this way.
- GaggiX 9mo agoI managed to run Balatro on a Trimui Brick on a very minimalist Linux distro, steamos should be easy.
- bsimpson 9mo agoThat's rad! Getting it to run in KDE was straightforward. I've gotta figure out why it instacrashes in SteamOS game mode.
- Abishek_Muthian 9mo agoIt's now on Portmaster if anyone is curious - https://portmaster.games/detail.html?name=balatro https://portmaster.games/detail.html?name=balatro
- Kelteseth 9mo ago> get it to run on SteamOS Huh? I had to do zero extra work to run it on the steam deck.
- bsimpson 9mo agoThe version sold in the Steam store runs the Windows build via Proton. (Valve's whole philosophy is you should build one version of your game, and their compatibility layers should be so bulletproof that it runs flawlessly everywhere.) In this case, I had the Game Pass version. It depends on a custom shared object `love.platform` that talks to Microsoft's cloud APIs to save/load your game and achievements. I used Gemini to write a bridge that implements all the `love.platform` calls in pure Lua, and then use the Linux build of LÖVE to run the game natively. Works great in KDE. Crashes when launched from Steam. Haven't gotten to why yet.
- JSR_FDED 9mo agoFor what kinds of applications is LuaJIT being used? I’ve always found the standard interpreter fast enough for my needs. Especially when compared to Python.
- ComputerGuru 9mo agoIf Python is your baseline, LuaJit is certainly going to be overkill. But to answer your question: when and where latency matters. Web apps, text editors, etc.
- orthoxerox 9mo agoAnywhere where you run hot loops in Lua inside your own hot loop. Game engines and network appliances are the most common use cases.
- jwitthuhn 9mo agoThe most recent integration I've seen is is OpenMW, which is an open source re-implementation of the Morrowind game engine. Basically it is built on the assumption that people are going to make mods that do a ridiculous amount of number-crunching in lua so any small improvement to performance is welcome.
- VadimPR 9mo agoOne challenge we have with Lua in Mudlet (FOSS text-based MUD client, think something akin to Roblox but for text) is that all of the player-created content is on Lua 5.1, and upgrading to 5.5 would be a breaking change for most. Has anyone solved an ecosystem upgrade like this?
- ec109685 9mo agoIs transpilation a thing in the Lua world like it is for JavaScript?
- kh_hk 9mo agoLike https://moonscript.org/ https://moonscript.org/ or https://teal-language.org/ https://teal-language.org/ ?
- dizhn 9mo agoYou're probably better off finding a way to support both.
- cardanome 9mo agoDo you have any reason to upgrade to 5.5? Many people still use 5.1 because that is already a complete language that works fine. Most people don't really need the new features. Plus if you stay on 5.1 you get compatibility with LuaJit and Luau so much better performance.
- VadimPR 9mo agoThere are nice new features in recent updates, but so far our strategy has been to stick to the version we use.
- spacechild1 9mo agoYou typically don't update Lua, you pick a version and stick with it.
- a_t48 9mo agoI miss working in Lua. Metatables are pretty powerful, and "everything is in a table" made it super easy to do hot reloading. At one point working on an iOS game, I had things set up so that when I hit save on my PC, my phone would pick up the changes and just start running the new code, as all persistent state was stored in a special table. Someday I need to look into getting the same kind of environment going for robotics, it was really a superpower.
- cmontella 9mo agoI'm building something like Lua for robots, you might want to check it out if you're looking to collaborate. I didn't know about Lua when I started it, but I did end up at an "everything is a table" metaphor because it seemed good for robotics. This does allow for cool things like hot reloading and such. Although, we've since moved to having several distinct data structures which conceptually map to tables, but implementation and syntax-wise have differences (mostly for performance). BTW Basis was a good idea, I remember reading about Nondeterministic replay is a big problem on platforms like ROS.
- kanbankaren 9mo ago> I didn't know about Lua when I started it How did you miss Lua? It has been available for decades and good SE practice is to evaluate alternatives before commiting to any techonology.
- a_t48 9mo agoI think I could actually build what I was thinking of on top of basis, but need to think about some things. Serialization of internal state was kicked around as a design idea at the start, but didn’t see enough benefit back then. In any case basis isn’t quite dead, I still use the thing as a test bed for ideas. I’ll take a look at your thing, too!
- snvzz 9mo agoStill waiting[0][1] for proper RISC-V support. 0. https://github.com/LuaJIT/LuaJIT/issues/628 https://github.com/LuaJIT/LuaJIT/issues/628 1. https://github.com/LuaJIT/LuaJIT/pull/1267 https://github.com/LuaJIT/LuaJIT/pull/1267
- luaisgarbageyes 9mo ago[flagged]
- jdndnrnr 9mo ago[dead]