Lua 5.1 recommended


In the documentation it is recommended one uses lua 5.1 for compatability reasons. So what exactly might be the harm in using 5.3 and what should I avoid there?

1 Like


We support Lua 5.1 because we also support LuaJIT 2.1.0-beta, which is based on Lua 5.1. We want our users to be able to run their (same) code on all our supported platforms.

Where does it say it’s “recommended”?

1 Like


It’s here:

We aim to keep Defold the same across all platforms, but we currently have a small discrepancy between Lua versions. For HTML5 and iOS 64 bit platforms we use Lua 5.1 but for other platforms we use LuaJIT. LuaJIT is based on 5.1 but contains a few additional features.

To keep your game working cross platform we suggest you stick to Lua 5.1 features.

I can see how there’s a little room for confusion, what I believe it means is:

  • There are two Lua versions used: Lua 5.1 and LuaJIT.
  • If you use LuaJIT features, your game will break on HTML5 and iOS.

Lua 5.3 features will just not work on any platform.

1 Like


But nowhere on that page says it’s “recommended”?



@Mathias_Westerdahl Are the docs up to date? I was under the impression that iOS ARM64 uses LuaJIT as well since some time ago? If it wasn’t so, coroutines would be broken in Interrogation since quite some time ago (yields across C function boundaries).

1 Like


Wild idea: Port this: for Emscripten using

That’d save some headscratching (it’s always unclear when coroutines would work in plain Lua due to that limitation and when they wouldn’t).



iOS uses the LuaJIT interpreter not the JIT part.
It might change later if Apple says jit is supported (still haven’t seen an official statement about it)

1 Like


On the Defold Lua page it states “To keep your game working cross platform we suggest you stick to Lua 5.1 features.” To suggest is to recommend I would say.



Thanks! Yes, I think we should rephrase that ( and the other parts relating to this)



I updated the Lua versions section: