Update Lua Version?

Posted by WillFa on Tue 04 Jul 2017 07:00 PM — 3 posts, 21,840 views.

USA #0
Hey Nick,

Are there any plans to update Lua 5.1 to current versions of 5.3?
USA Global Moderator #1
I believe that 5.3 isn't fully compatible with code written for 5.1.
If the Lua engine is ever replaced, I'd rather see LuaJIT 2.1 get rolled in. Aside from various performance benefits, it also incorporates useful functionality from later Lua versions without breaking the 5.1 API/ABI. The only error-causing change it makes afaik is to abort on invalid string formatting instead of proceeding silently with potentially wrong behavior like 5.1 does (this is a safety feature that only happens when the author doesn't know how to achieve their intended goal with string escapes).
Amended on Wed 05 Jul 2017 02:17 PM by Fiendish
Australia Forum Administrator #2
There were some major changes in Lua 5.2 which put me off attempting to implement it.

See Changes in the Language

In particular:

  • Function module is deprecated. It is easy to set up a module with regular Lua code. Modules are not expected to set global variables.
  • Functions setfenv and getfenv were removed, because of the changes in environments.


This would impact on the way that things like table serialization work. Also, testing showed that other DLLs would be incompatible with Lua 5.2. For example, the MySQL DLL.

Basically, because of the changes to things like setfenv, existing code just wouldn't work. And even if it could be got to work you would then have to fiddle around getting the correct DLLs for other functions (if you wanted MySQL, for example). It was just going to be a mess.

Lua 5.1 works, and in this case my philosophy is "if it ain't broke, don't fix it".