In GMod13 we’ve switched over to LuaJIT. This is something that people have requested for a few years, but I’ve resisted due to some incompatibilities. So here’s what you need to know.
Benefits
LuaJIT is faster than plain Lua. If you need to know how or why you can find that info on their site. But something to consider is that this isn’t going to take your FPS in GMod from 20 to 100. Most of the strain in the engine is still going to be rendering – the graphics card is almost always the bottleneck.
You should also consider that Lua isn’t really doing any hard work in GMod. In general Lua is only really being used to call engine functions. You’re only really going to see a speed increase if you’re doing a lot of processing with Lua.
That’s not to say there aren’t any speed increases. In a timedemo I ran a few times I averaged 132fps with LuaJIT, and 126 without.
Changes
GMod changes the Lua syntax in a few ways. It adds C comments, it adds the continue keyword, it addsย !not and && and ||.
The old version also added bitwise | and &. These are removed in the new version – which is going to break some code that relies on it. I chose to make this change now while we’re breaking other stuff. We have access to the luajit bit library now – which is a lot more complete.
Another change worth noting is that the global “_R” no longer exists. It’s accessible via debug.getregistry().
Add a Comment