image.png

🚨 Official Update: Lua 5.3 Runtime Removed

FiveM has officially removed the Lua 5.3 runtime from Canary builds and will remove it from all release channels in the next production release. This change, which was previously in testing, is now live and affects all FiveM servers.

The Lua 5.4 runtime has been updated to version 5.4.8, making it the exclusive scripting environment for all FiveM resources moving forward.

⚠️ Who Is Affected

Any server owner or developer using Lua scripts may be affected by this change. While Lua 5.4 is generally backwards compatible with Lua 5.3, there are some important differences that could break existing scripts.

If you were already using the lua54 setting in your resource manifests, you should see minimal impact. However, all scripts now run exclusively on Lua 5.4 regardless of manifest settings.

🔧 Known Incompatibilities

Language Changes

String to Number Coercion

  • Arithmetic and bitwise operations no longer automatically convert strings to numbers
  • Example: "1" + "2" now returns an integer, not a float
  • The string library handles arithmetic operations via metamethods

Integer Overflow Behavior

  • Literal decimal integers that overflow are now read as floats instead of wrapping around
  • Use hexadecimal notation if you need the old wrap-around behavior

Metamethod Changes

  • The __lt metamethod no longer emulates __le - you must explicitly define __le when needed
  • Non-function __gc metamethods will still be called (generating warnings for non-callable values)

For Loop Semantics

  • Numerical for loops over integers have changed - the control variable never wraps around

Goto Labels

  • Labels cannot be declared where a label with the same name is already visible in an enclosing block

Library Changes

JSON Handling

  • json.decode no longer accepts:

    • Square brackets
    • Unkeyed values
    • Numbers as keys

Print Function

  • print() no longer calls tostring() - functionality is now hardwired
  • Use __tostring metamethod to modify how values are printed

Random Number Generation

  • math.random uses a different algorithm with a more random seed
  • Results will differ from Lua 5.3 even with the same seed

UTF8 Library

  • Decoding functions don't accept surrogates as valid code points by default
  • Add extra parameter for permissive mode if needed

Garbage Collection

  • collectgarbage("setpause") and collectgarbage("setstepmul") are deprecated
  • Use collectgarbage("incremental") instead

File I/O

  • io.lines now returns four values instead of one
  • Wrap in parentheses when used as sole argument: load((io.lines(filename, "L")))

🛠️ What You Need to Do

Server Owners

  • Test your server immediately on a development environment
  • Check all custom scripts for compatibility issues
  • Update any scripts that use deprecated functions or rely on old behavior
  • Monitor console output for new warnings or errors

Script Developers

  • Review the Lua 5.4 changelog for comprehensive changes
  • Update resource manifests - lua54 setting is now ignored
  • Test string operations that might have relied on automatic coercion
  • Validate JSON parsing if using json.decode with non-standard formats

📈 Benefits of This Change

Performance Improvements

  • Better overall performance with Lua 5.4 optimizations
  • More efficient memory management

Long-term Maintainability

  • Reduces platform fragmentation
  • Enables support for latest tooling and security updates
  • Simplified development environment

Modern Language Features

  • Access to new Lua 5.4 features and improvements
  • Better error handling and debugging capabilities

🆘 Getting Help

If you encounter breaking changes or need assistance with the transition:

  • Join the FiveM Discord server for community support
  • Report issues to help improve compatibility
  • Check the Lua 5.4 changelog for detailed technical information

The removal of Lua 5.3 support represents a significant step forward for FiveM's development platform, but proper preparation is essential to ensure a smooth transition for your server and community.