robofanatic
How hard is it to put a simple hello world example on the homepage.
BanazirGalbasi
Because 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.
maxpert
I 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.
sellmesoap
I think that's doable. https://github.com/zacharie410/lua-browser-dom-demo
tormeh
Ypu 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.
1313ed01
If 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.
klysm
Curious how this fits in with WASM
gucci-on-fleek
ConTeXt 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
[1]: https://wiki.contextgarden.net/Introduction/Installation
Kerrick
We 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
Oh I hope that don't do that.
ksymph
> 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?
GranPC
In 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.
pvitz
From 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.altairprime
List of changes: https://lua.org/manual/5.5/readme.html#changes
mysterEFrank
OG torch strikes back?
parlortricks
Excellent new release, now for Fennel and Love2d to update, fun times!
gsck
Cannot 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
The 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
And Luau.
pull_my_finger
5.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
> 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.
thayne
True. But
1. The luajit documentation basically just had a list of features. AFAIK there isn't any documentation that combines the 5.1 reference with luajit extensions (including things that were backported)
2. In some cases, for example Neovim, luajit extensions aren't guaranteed to be available. It just says there will be a lua runtime compatible with 5.1. Which means a truly portable neovim plugin can't use those extensions
3. There are features from later lua versions I would like to have (in particular <const> and <close>) that will probably never get backported.
4. Some features require luajit to be built with special flags
petcat
I'm pretty sure that's only OpenResty's distribution of LuaJIT.
I think the real LuaJIT is strictly 5.1
Tharre
Not true, see "Extensions from Lua 5.2" here: https://luajit.org/extensions.html
reactordev
No, real LuaJIT has some features from 5.2 and 5.3
null
sunshine-o
I 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&sek...
Fwirt
The 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 If you want async IO, sockets, etc, check out Luvit. 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.
artemonster
please resurrect Mike Pall
thayne
Mike Pall made a commit to LuaJIT just a couple of weeks ago.
One 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