# Scripting Language extensions via plugins

**URL:** <https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542>\
**Category:** C++\
**Tags:** unreal-engine, Engine-Source-Code, GitHub, Engine-Source-GitHub\
**Created:** [April 30, 2014, 11:55am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542 "2014-04-30T11:55:21Z")\
**Posts on this page:** 20\
**Page:** 7

<div class="post-metadata">

**Author:** ![anonymous\_user\_64c55f0b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_64c55f0b](https://forums.unrealengine.com/u/anonymous_user_64c55f0b)\
**Post date:** [August 4, 2014, 12:19pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/122 "2014-08-04T12:19:27Z")

</div>

> [@alexgrist;108506](#):
>
> > [@HavocX;108066](#):
> >
> > As Unity is your biggest competitor in the indie space, well working C# integration could be a wise move for luring over even more developers from them. Compiling to Javascript might be the best way to handle it.
> 
> I agree entirely, C# would be amazing. Although I think the script integration needs a lot more work before that’s possible.

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](http://www.computercraft.info/) mod for Minecraft) Would that be feasible to have running alongside the scripting level Lua VM discussed in this thread?

---

<div class="post-metadata">

**Author:** ![jCoder](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jCoder](https://forums.unrealengine.com/u/jCoder)\
**Post date:** [August 4, 2014, 1:40pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/123 "2014-08-04T13:40:01Z")

</div>

> [@Veovis Muad'dib;110960](#):
>
> 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.

There was a [thread](https://forums.unrealengine.com/showthread.php?110-Mono-C-Bindings-for-Unreal-4) 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](https://forums.unrealengine.com/showthread.php?110-Mono-C-Bindings-for-Unreal-4&p=4789&viewfull=1#post4789)

---

<div class="post-metadata">

**Author:** ![enlight\_2014](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@enlight\_2014](https://forums.unrealengine.com/u/enlight_2014)\
**Post date:** [August 4, 2014, 6:23pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/124 "2014-08-04T18:23:22Z")

</div>

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](https://github.com/enlight/klawr), 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).

---

<div class="post-metadata">

**Author:** ![alexgrist](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@alexgrist](https://forums.unrealengine.com/u/alexgrist)\
**Post date:** [August 5, 2014, 12:19am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/125 "2014-08-05T00:19:34Z")

</div>

> [@Veovis Muad'dib;110960](#):
>
> 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](http://www.computercraft.info/) mod for Minecraft) Would that be feasible to have running alongside the scripting level Lua VM discussed in this thread?

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.

---

<div class="post-metadata">

**Author:** ![JohnnyGuitar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JohnnyGuitar](https://forums.unrealengine.com/u/JohnnyGuitar)\
**Post date:** [August 16, 2014, 7:12am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/126 "2014-08-16T07:12:48Z")

</div>

I’m very excited for 4.4 because of this.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6abc9b3d1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6abc9b3d1](https://forums.unrealengine.com/u/anonymous_user_6abc9b3d1)\
**Post date:** [August 17, 2014, 9:32pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/127 "2014-08-17T21:32:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4cb3192d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4cb3192d](https://forums.unrealengine.com/u/anonymous_user_4cb3192d)\
**Post date:** [August 18, 2014, 11:19pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/128 "2014-08-18T23:19:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![enlight\_2014](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@enlight\_2014](https://forums.unrealengine.com/u/enlight_2014)\
**Post date:** [August 19, 2014, 3:44am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/129 "2014-08-19T03:44:53Z")

</div>

> [@goatytimes;121000](#):
>
> Is this in 4.4? I didn’t see it in the notes.

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

> [@](#):
>
> Removed ScriptAsset, ScriptFunction and ScriptActor classes from ScriptPlugin

---

<div class="post-metadata">

**Author:** ![alexgrist](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@alexgrist](https://forums.unrealengine.com/u/alexgrist)\
**Post date:** [August 19, 2014, 8:09pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/130 "2014-08-19T20:09:46Z")

</div>

You missed a fairly important change:

> [@](#):
>
> Script Plugin: adding the ability to create script classes from any Blueprintable base class

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6abc9b3d1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6abc9b3d1](https://forums.unrealengine.com/u/anonymous_user_6abc9b3d1)\
**Post date:** [August 19, 2014, 8:13pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/131 "2014-08-19T20:13:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_95199705](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_95199705](https://forums.unrealengine.com/u/anonymous_user_95199705)\
**Post date:** [August 20, 2014, 7:38pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/132 "2014-08-20T19:38:47Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Kafumanto](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kafumanto/32/1194651_2.png) [@Kafumanto](https://forums.unrealengine.com/u/Kafumanto)\
**Post date:** [August 21, 2014, 3:06pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/133 "2014-08-21T15:06:10Z")

</div>

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”?

---

<div class="post-metadata">

**Author:** ![alexgrist](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@alexgrist](https://forums.unrealengine.com/u/alexgrist)\
**Post date:** [August 22, 2014, 12:11am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/134 "2014-08-22T00:11:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Kafumanto](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kafumanto/32/1194651_2.png) [@Kafumanto](https://forums.unrealengine.com/u/Kafumanto)\
**Post date:** [August 22, 2014, 4:55pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/135 "2014-08-22T16:55:17Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a36a29c6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a36a29c6](https://forums.unrealengine.com/u/anonymous_user_a36a29c6)\
**Post date:** [August 23, 2014, 7:47pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/136 "2014-08-23T19:47:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Stimpy77](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Stimpy77](https://forums.unrealengine.com/u/Stimpy77)\
**Post date:** [August 24, 2014, 11:28pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/137 "2014-08-24T23:28:43Z")

</div>

> [@BenFreidlin;107849](#):
>
> > [@](#):
> >
> > I was suggesting V8 as a script host target for integration, and note that there are several language that compile down to JS including Lua and C#. Chromeexperiments dot-you-know is strong validation that V8 is a quite reasonable scripting engine for HUD and background tasks.
> 
> I don’t find this an appealing idea, it seems clever, but the amount of testing and validation to prove that it would be a 1:1 match with language bindings, existing libraries, and as performant as the language in its best/most optimized environment (LuaJIT for example) doesn’t seem worth the hassle.

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](http://nodejs.org/api/addons.html#addons_wrapping_c_objects)

> [@](#):
>
> Many people using UE4 are doing so for commercial projects,

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

> [@](#):
>
> and having something this experimental is not likely worth the risk.

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?

> [@](#):
>
> The point of the plugin architecture seems to be to allow anyone to implement whatever scripting language they want. I suppose the nice thing is if you want to see V8 in UE4, you now have a framework to achieve that in.

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.

> [@](#):
>
> It will continue to catch on for gaming due to the growth of HTML5, but I would not bet on it replacing Lua for commercial console and PC games any time soon.

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.

---

<div class="post-metadata">

**Author:** ![jCoder](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jCoder](https://forums.unrealengine.com/u/jCoder)\
**Post date:** [August 24, 2014, 11:40pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/138 "2014-08-24T23:40:43Z")

</div>

> [@Stimpy77;125424](#):
>
> For PC games I think you’re selling the power of V8 short, you don’t know because I don’t recall that it has ever been tried as a scripting language for games, outside of simplistic UI overlays, but 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.

---

<div class="post-metadata">

**Author:** ![enlight\_2014](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@enlight\_2014](https://forums.unrealengine.com/u/enlight_2014)\
**Post date:** [August 25, 2014, 2:29pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/139 "2014-08-25T14:29:52Z")

</div>

> [@;98169](#):
>
> That makes sense, sure. I originally thought that there’s going to be multiple plugins that support a specific language and this one could be used as a template once it matures (because I imagine that each integration would like to add specific functionality to it). However, I guess it could be possible to dynamically support different language contexts and have the engine -\> script glue (class compiler etc) be only one. I’ll look into it.

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_52cc6b721](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_52cc6b721](https://forums.unrealengine.com/u/anonymous_user_52cc6b721)\
**Post date:** [August 25, 2014, 3:47pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/140 "2014-08-25T15:47:59Z")

</div>

> [@;125831](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a36a29c6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a36a29c6](https://forums.unrealengine.com/u/anonymous_user_a36a29c6)\
**Post date:** [August 30, 2014, 7:37pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/142 "2014-08-30T19:37:32Z")

</div>

> [@;124272](#):
>
> 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.

Still haven’t found a solution for this problem…

[Previous page](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542.md?page=6)

[Next page](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542.md?page=8)
