Interesting, 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.
But.. 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?
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)
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
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.
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.
You 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.
Most people don't use the standard library to make a HTTP request in Python either...
I agree with the sentiment though, I even gave a talk about this at Lua Workshop 2013 (https://www.lua.org/wshop13/Chapuis.pdf) around that issue. There are good reasons why several important but OS-specific features are not included in the core language. Discussion around a "blessed" extended standard library module arise from time to time but never lead anywhere.
The Lua community - at least the one around PUC Lua - is reasonably small and you can typically look at what active popular projects use to figure out the best libraries. The LuaRocks download count can be an indicator as well. But I agree this is still a problem.
That'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.
But 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.
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.
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?
I 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.
For 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.
One 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.
I 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.
31 comments
[ 0.96 ms ] story [ 286 ms ] threadIt’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.
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)
[0]: https://codeberg.org/contextgarden/context
[1]: https://wiki.contextgarden.net/Introduction/Installation
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...
I agree with the sentiment though, I even gave a talk about this at Lua Workshop 2013 (https://www.lua.org/wshop13/Chapuis.pdf) around that issue. There are good reasons why several important but OS-specific features are not included in the core language. Discussion around a "blessed" extended standard library module arise from time to time but never lead anywhere.
The Lua community - at least the one around PUC Lua - is reasonably small and you can typically look at what active popular projects use to figure out the best libraries. The LuaRocks download count can be an indicator as well. But I agree this is still a problem.
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.
[1] https://www.freelists.org/post/luajit/Question-about-LuaJIT-...
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?
That's huge. I wish LuaJIT adopted this, or at least added a compile time flag to enable it.
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.
Has anyone solved an ecosystem upgrade like this?
0. https://github.com/LuaJIT/LuaJIT/issues/628
1. https://github.com/LuaJIT/LuaJIT/pull/1267