Download

Using LUA with Unreal Engine 4

Hello! I’m starting a new project and we are thinking of using Unreal Engine 4 for that project.
The discussion about C++ and LUA came up.
I wonder if it’s possible to intergrate LUA to Unreal Engine 4 via C++ code?
To make it possible to do hot reloads and runtime compilations?

Yes it is.

I am actually working on a JS binding, but LUA is just as reasonable.

It’s always depends on what you wanna do with LUA, in most case Blueprints will do a way better job than LUA. But, yeah, in some case like moddable game that dont want to force users to get UE4 to be able to mod LUA might be a good solution.

I have also considered writing a LUA binding, however for now I have decided to integrate the TinyJs javascript interpreter. As this seemed like it would most likely be the quickest way of getting something up and running. I started a thread about it earlier today over in the Blueprint section, as I’ve integrated it into blueprint. So that a user can add scripting nodes to a blueprint and define the sections of js code that will run when those nodes execute. https://forums.unrealengine.com/showthread.php?1753-Simple-JavaScript-Scripting-interpreter-embedded-in-BluePrint

One issue that I have found that I think you might also have with Lua, is that I’m having to write static wrapper functions for all the Unreal class methods that I want to expose to the scripts. As it only supports registering c type function pointers.