Lua 5.4 Released
Written by Kay Ewbank   
Friday, 03 July 2020

There's a new release of the scripting language Lua, five years after the previous update. Version 5.4 brings improved garbage collection, support for to-be-closed variables and a new implementation of math.random.

Lua is a scripting language popular for embedding in games and in industrial applications such as robotics, image processing, text editors and web development. It was created in Brazil and was designed to be simple, small, portable, fast, and easily embedded into applications.


The language supports functions as first class objects, closure and extensible semantics. It also isn't a class-based language. Overall it most resembles JavaScript of all the currently popular languages.

The first improvement to the new release is a new generational mode for garbage collection. This means the collector does frequent minor collections where the collector traverses only those objects that have been recently created. If after a minor collection the use of memory is still above a limit, the collector does a stop-the-world major collection, which traverses all objects.

Another improvement is support for to-be-closed variables. These  behave like constant local variables, but their value is closed whenever the variable goes out of scope, including when this is by normal block termination, exiting its block by break/goto/return, or exiting by an error.

There's also a new implementation for math.random. In the previous version, math.random was based on the standard C rand function, which has the disadvantage that it gives different results on Windows and Linux. The new release bases the math.random function on xoshiro256** algorithm which produces pseudo-random 64-bit integers.

Other improvements include support for const variables, and the ability for userdata to have multiple user values. There's a new warning system, and you can get debug information about function arguments and returns. A number of other minor improvements can be found in the readme documentation.  



More Information

Lua Website

Related Articles

Lua 5.3 Released  

Lua 5.2.0 Released

Standalone Lua Development Tools 

Terra - A Language For Lua

Seven More Languages in Seven Weeks (book review)

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.


Insights Into Software Supply Chain Security

A report from Chainguard reveals that while software developers and security leaders are committed to tackling software supply chain security, differences in their perspectives and prioritie [ ... ]

Perl Dancer2 Web Framework Updated

Despite the project going back to 2009, the just announced release is 1.0.0. Let's look at this milestone release, adopting a retrospective attitude. Of course, we are talking about Dancer2  [ ... ]

More News




or email your comment to:





Last Updated ( Friday, 03 July 2020 )