Removal of Lua 5.3 Support

As of today, the Lua 5.3 runtime has been removed from Canary and will be removed from all release channels on our next production release date. The Lua 5.4 runtime has been updated to the latest version (5.4.8).

Anyone who uses Lua scripts may be affected: although Lua 5.4 is generally backwards compatible with Lua 5.3, there are some small differences between them:

Known Incompatibilities

Incompatibilities in the Language

  • The coercion of strings to numbers in arithmetic and bitwise operations has been removed from the core language. The string library does a similar job for arithmetic (but not for bitwise) operations using the string metamethods. However, unlike in previous versions, the new implementation preserves the implicit type of the numeral in the string. For instance, the result of "1" + "2" now is an integer, not a float.

  • Literal decimal integer constants that overflow are read as floats, instead of wrapping around. You can use hexadecimal notation for such constants if you want the old behavior (reading them as integers with wrap around).

  • The use of the__lt metamethod to emulate__le has been removed. When needed, this metamethod must be explicitly defined.

  • The semantics of the numerical for loop over integers changed in some details. In particular, the control variable never wraps around.

  • A label for a goto cannot be declared where a label with the same name is visible, even if this other label is declared in an enclosing block.

  • When finalizing an object, Lua does not ignore __gc metamethods that are not functions. Any value will be called, if present. (Non-callable values will generate a warning, like any other error when calling a finalizer.)

Incompatibilities in the Libraries

  • json.decode no longer accepts square brackets, unkeyed values, or numbers as keys.

  • The function print does not call tostring to format its arguments; instead, it has this functionality hardwired. You should use __tostring to modify how values are printed.

  • The pseudo-random number generator used by the function math.random now starts with a somewhat random seed. Moreover, it uses a different algorithm.

  • By default, the decoding functions in the utf8 library do not accept surrogates as valid code points. An extra parameter in these functions makes them more permissive.

  • The options “setpause” and “setstepmul” of the function collectgarbage are deprecated. You should use the new option “incremental” to set them.

  • The function io.lines now returns four values, instead of just one. That can be a problem when it is used as the sole argument to another function that has optional parameters, such as in load(io.lines(filename, "L")). To fix that issue, you can wrap the call into parentheses, to adjust its number of results to one.

We also recommend reading the Lua 5.4 changelog for more information.

This update helps to ensure better performance and long-term maintainability. Deprecating older versions also reduces fragmentation and helps us support the latest tooling and security updates.

If you find any breaking changes or have any additional feedback on this change, please head over to our Discord server to let us know.

36 Likes

I mean, sure…

3 Likes

backdrop-filter support!

7 Likes

backdrop-filter already works in FiveM’s NUI:s & DUI:s, and has been for quite a while.

3 Likes

backdrop-filter is working perfectly fine, just you cannot use it directly, I mean if it’s directly on the game. Something has to be under it. like x-cfx-game-view object, or a full color div.

4 Likes
7 Likes

shrek-shrek-rizz

2 Likes

good good :relieved:

3 Likes

Is the lua54 parameter in fxmanifest still needed? because after the update all of my lua 5.4 scripts have syntax errors

1 Like

And only in canary BTW

3 Likes

That’s crazy that you’re doing this before releasing enhanced support

7 Likes

Why was Lua 5.3 removed?

3 Likes

Just why?….

2 Likes

Would say I’m going to miss it but i don’t think i am :sob:

2 Likes

I can’t wait to experience issues for scripts that I can’t even fix due to escrow. This seems completely unnecessary.

5 Likes

Idk why it wasn’t mentioned in the post but all Escrowed scripts were already using Lua 5.4. So there should be major issues relating to the 5.3 → 5.4 migration because it simply won’t happen. All 5.3 scripts are open source.

There could be additional issues with the 5.4 → 5.4.8 update changing some power patches and I think the team is already aware of a few (like the +=, -=, etc. compound operators acting a bit differently).

7 Likes

Thanks for the clarification on that, that is at least good to know. I’ve not paid much mind to escrowed scripts really because they’re a headache.

I’m wondering if this is why today we had issues with functions that utilise vector math for some clients, we had to advise they switch to beta.

2 Likes

What was happen with optional chaining?

2 Likes

There were some bug fixes with optional chaining but it may have introduced other issues based on what I’m seeing. Reposting this from the experiment thread:

The custom safe navigation operator in 5.4 has been slightly changed. It now also supports calls, and jumps to the end of the expression, rather than just skips the current access.

x = nil
print(x?.foo.bar) -- nil
print(x?.foo.bar or 10) -- 10
print(x?.foo('hi').bar or 20) -- 20

x = {}
print(x.foo?.bar) -- nil
print(x.foo?.bar or 10) -- 10
print(x.foo?('hi').bar or 20) -- 20

I think currently you can’t call functions after optional chaining it seems, which is probably a bug.

This doesn’t work

x?.func()

While this does work

x?.func() or nil
3 Likes

Yeah, I already noticed that and that was a problem in my case

2 Likes