How to use Vanilla Lua 5.1 instead of LuaJit

In some cases, it might be useful to use vanilla Lua instead of LuaJIT.

TL;DR: Thanks to @aglitchman, we have this simple extension just use it.



Working on a Lua memory profiler, I found that Tail Call optimizations in LuaJIT make it hard to collect data for the profiler. Thanks to the engine’s modularity, it’s possible to replace LuaJIT with Vanilla Lua 5.1 using the AppManifest (also because we have a Vanilla Lua 5.1 build for all the platforms).

However, Lua 5.1 lacks bit operations, but we can manually copy and paste them from the engine into our extension, and it works.

@aglitchman extracted this approach from GitHub - defold/extension-lmprof: Lua memory profiler for Defold based on lmprof and created a separate small extension that does just that: replace LuaJIT with Lua 5.1. If for some reason you need this, feel free to use his extension:

12 Likes