Scripting Language extensions via plugins

I registered to say that this is completely true. I’m a Unity3D indie developer that is tempted to jump over to Unreal. If I could use C# for most things I’d absolutely pay for a month and see where it went from there. Given the low pricing model (upfront at least) I’d be pretty likely to stick around.

I can read and write C++, but it seems to take me far longer to get to quality C++ code than it takes to get to quality C# code.

On the topic of Lua however, does the current implementation support creating more of a sandboxed Lua machine? Say I wanted to have a few independent simulations running that had very specific things they were allowed to do, maybe even code written by players. (For example, the Computercraft mod for Minecraft) Would that be feasible to have running alongside the scripting level Lua VM discussed in this thread?

There was a thread soon after the engine was released that discussed this option. The big issue is the LGPL/GPL licenses and on it intersects with the UE4 EULA. It’s one of the reasons I’m working with Google’s V8 instead of Mono.

Edited: Someone is already working on it

I started work on CLR integration based on Robert’s plugins a couple of weeks ago. I’ve got it spitting out some non-functional C# wrapper classes at the moment, but I’m still a few weeks away from a “Hello World” of any kind. The MS CLR only works on Windows, so it’s not going to be a cross-platform solution. The project is on GitHub, but it would be a waste of time building it yourself right now, which is why I haven’t provided any instructions yet (I’m also hoping that in the near future language integrations can be enabled without forking the engine and patching Robert’s plugins).

I took at look at the recent commits on the script integration and it seems that it’s still being worked on. By the looks of it 4.4 will allow you to use the script integration on anything blueprintable, which is a great step forward but I haven’ had a to play around with it yet. C# or Lua would be amazing when integrated properly.

I’m very excited for 4.4 because of this.

Is there any tutorial on how to use this plugin? I installed it, but now I want to know how I can start using Lua to code in UE4? It would be nice to have documentation on how to start using Lua like a simple “Hello World” tutorial.

Is this in 4.4? I didn’t see it in the notes. This would probably be the sort of thing I would resubscribe for once it’s fully usable

It’s under the Core section of the release notes:

You missed a fairly important change:

It would be nice to have some basic documentation up for using this plugin.

Has anyone been able to compile the ScriptPlugin with the latest-preview or master-branch ?
I keep getting error C1853 - something about the PCH files being C++ which conflicts lua C.

Is there a simple workaround for this issue ?

As all mentioned plugins (SGP, SP, SEP) are enabled in the official 4.4 build, is there a way to add Lua support without the need to recompile the whole engine from sources? Maybe via a “Game Plugin”?

I think you could possibly copy out the plugins (or maybe just ScriptPlugin) and compile your game source as long as you set it up correctly for unreal build tool.

Maybe there is is a circular dependency problem: the bundled ScriptEditorPlugin depends on the bundled ScriptPlugin, if I disable the bundled ScriptPlugin (that doesn’t use Lua) to use my own “MyLuaScriptPlugin” (game plugin, compiled with Lua) the dependencies break and the editor complains. Or maybe I’m not properly compiling MyLuaScriptPlugin…

When I compile for iOS I get this issue: E:\UE4\UnrealEngine\Engine\Plugins\Script\ScriptPlugin\Source\ScriptPlugin\lua-5.2.3\src\loslib.c(108,3): error: ‘tmpnam’ is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tmpnam(3), it is highly recommended that you use mkstemp(3) instead. -Werror,-Wdeprecated-declarations]
[44/227] ldblib.c
lua_tmpnam(buff, err);
^
/UE4/Builds/XXXX-PC/E/UE4/UnrealEngine/Engine/Plugins/Script/ScriptPlugin/Source/ScriptPlugin/lua-5.2.3/src/loslib.c:57:33: note: expanded from macro ‘lua_tmpnam’
#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); }
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/usr/include/stdio.h:274:7: note: ‘tmpnam’ declared here
char *tmpnam(char *);
^
1 error generated.

What on earth are you talking about?? Have you ever even read about this topic, much less used it? All scripting languages are high level abstractions to native bindings. NodeJS is one of the most popular platforms for automating asynchronous native interfaces in commercial environments. The interfacing is comprehendable to beginners as shown here: C++ addons | Node.js v21.4.0 Documentation

You don’t say! Really? I had no idea! sigh I can haz condescension skillz too …

Uh, I’m sorry but you used the word “experimental”. This is alpha stage development as it is–not the engine, but the topic. V8 is less experimental than Mono, with a far greater install base and reach, yet how many commercial Unity3D games using Mono have been published?

Exactly, V8 notwithstanding. Whether you like the idea of V8 or not, so long as the plugin architecture stabilizes and has a sufficient foothold in the scope of the engine I have no doubt V8 will come, I was only trying to encourage others to get the ball rolling.

For PC games IMO if it can handle the realtime automation I work with in the commerical product I help build in my day job every day, I have no doubt it could complement a AAA commercial game engine for low-priority scripting very, very well.
Anyway I made no intentional inference that JS should or would replace Lua for commercial games. What I was communicating was that I personally find Lua to be less interesting and less powerful than the flexibility and options that V8 could bring to the table, and I personally would prefer to write for V8, and I personally think that others in the community here should consider this as a subject of interest.

I’ve been working on hooking up V8 to UE4 for a lot of the reasons you mention. I’m working on the thunks between the engine and in make the UE4 API available in JS. PM me if you’re interested in testing when it’s available.

To date I’ve had to make a few changes to ScriptPlugin, and now I’m going to move all those changes into a separate plugin. Which is to say, you were right about this set of plugins being just a template.

The same thing is being done with the plug-in - it is being written as a separate plug-in using 's Script plug-in as an example. There are lots of differences between and Lua - in particular everything is checked at compile-time rather than run-time.

If there is any cross compatible code I’ll try to integrate it into the example Script plug-in so that it can be shared.

Still haven’t found a solution for this problem…