# 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:** 3

<div class="post-metadata">

**Author:** ![anonymous\_user\_cd1fb4591](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_cd1fb4591](https://forums.unrealengine.com/u/anonymous_user_cd1fb4591)\
**Post date:** [May 29, 2014, 8:07am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/42 "2014-05-29T08:07:19Z")

</div>

I am following this thread since it was open. Looking forward to getting Lua support.

Can we expect Lua support to be a first order citizen, just like Blueprints?

---

<div class="post-metadata">

**Author:** ![Dantarion](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dantarion](https://forums.unrealengine.com/u/Dantarion)\
**Post date:** [May 29, 2014, 8:19pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/43 "2014-05-29T20:19:15Z")

</div>

I think it would be interesting to see Lua become a feature bullet for UE4, and possibly other lightweight languages that can be fit into this existing framework as well.

I have read through the LuaIntegration classes, and I wonder how hard it would be to create PythonIntegration, XIntegration, etc.  
I think there needs to be a bit more work to it to have this feature more easily accessible from C++land, but the potential is endless!

---

<div class="post-metadata">

**Author:** ![robert.manuszewski](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@robert.manuszewski](https://forums.unrealengine.com/u/robert.manuszewski)\
**Post date:** [May 31, 2014, 8:16am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/44 "2014-05-31T08:16:19Z")

</div>

> [@Element9;61521](#):
>
> Can we expect Lua support to be a first order citizen, just like Blueprints?

We’re not currently planning to make any samples/games with it, but on the other hand it’s still not mature enough. I guess we’ll see how it goes. I am committed to supporting it though!

---

<div class="post-metadata">

**Author:** ![robert.manuszewski](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@robert.manuszewski](https://forums.unrealengine.com/u/robert.manuszewski)\
**Post date:** [May 31, 2014, 8:20am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/45 "2014-05-31T08:20:40Z")

</div>

> [@Dantarion;62101](#):
>
> I think it would be interesting to see Lua become a feature bullet for UE4, and possibly other lightweight languages that can be fit into this existing framework as well.
> 
> I have read through the LuaIntegration classes, and I wonder how hard it would be to create PythonIntegration, XIntegration, etc.  
> I think there needs to be a bit more work to it to have this feature more easily accessible from C++land, but the potential is endless!

Yeah, there’s much potential and some very exciting things coming soon (better Blueprints integration and exposure to the editor)!

As for Python vs Lua - I never used Python, I did use Lua many years ago so that’s why I chose it for the proof-of-concept integration. I guess it wouldn’t be too hard to add Python too but I think we need to make Lua integration (and generally - the plugin itself) more solid and mature. Then adding new scripting language integration is only going to be a matter of a few working days.

---

<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:** [May 31, 2014, 7:31pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/46 "2014-05-31T19:31:54Z")

</div>

> [@;63359](#):
>
> We’re not currently planning to make any samples/games with it, but on the other hand it’s still not mature enough. I guess we’ll see how it goes. I am committed to supporting it though!

Great work Robert! Here another +1 for “Lua first citizen” 😉

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_cd1fb4591](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_cd1fb4591](https://forums.unrealengine.com/u/anonymous_user_cd1fb4591)\
**Post date:** [June 1, 2014, 7:29pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/47 "2014-06-01T19:29:33Z")

</div>

I wouldn’t need the samples “just” for it to be feature complete and maintained.

C++ and Blueprints are great, but I’d really like a scripting language for UE4.

Thanks for the work on it!

---

<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:** [June 4, 2014, 10:20pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/48 "2014-06-04T22:20:53Z")

</div>

Landed on 4.2! Great!

---

<div class="post-metadata">

**Author:** ![robert.manuszewski](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@robert.manuszewski](https://forums.unrealengine.com/u/robert.manuszewski)\
**Post date:** [July 3, 2014, 11:24am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/49 "2014-07-03T11:24:20Z")

</div>

Hey everyone,

Quick update on the scripting integrations (so I guess that means Lua in particular :)):

You may be interested in two changes I checked in today (took a while to get this out, still WIP): [Script Blueprint Classes](https://github.com/EpicGames/UnrealEngine/commit/41d1e2ccb76b2144452ede7c7b0139ee881dbf1a) and [Script Property Propagation](https://github.com/EpicGames/UnrealEngine/commit/4b1414bf5dbd909c3f5e8ec3a8ce3e8436df867f)

So basically now you’re able to create Blueprint Classes from Lua. They will have all gloabal Lua variables exported as public properties (which you can set defaults for in a special version of BlueprintEditor) and all parameter-less global functions that start with “Event” exported as Blueprint-callable functions (works only for ScriptActors atm). Setting Lua properties from Blueprints works as expected, and the values are updated on the script side. The same goes for setting these properties on Lua side - they get propagated to the generated Blueprint class.

Also you can now chose between two base classes for your Lua Blueprints: ScriptActor and ScriptComponent. I’m pondering the possibility of specifying just about any Blueprintable base class and I’m definitely going to add it when I figure out the best way to do it. Cool thing is that you can basically use your ScriptComponent-derived components when designing ‘normal’ blueprints. Oh, and you should be able to specify the Lua generated Blueprints as base classes for normal Blueprints as well. It’s all Blueprint magic!

I’m planning to focus on user experience now. For now, Lua scripts are not automatically re-compiled and you need to double click on the class to open BP editor and click compile in there to do it. I also want to add the ability to have Lua scripts listed in generated projects in IDE (VS etc).

I think we are really close to production-ready phase with this now.

---

<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:** [July 3, 2014, 3:25pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/50 "2014-07-03T15:25:48Z")

</div>

I’ve been working on a plugin that embeds Google V8 for javascript and even have coffeescript working as well. I’m watching this closely as I want to rewirte it to use your architecture.

> [@](#):
>
> Also you can now chose between two base classes for your Lua Blueprints: ScriptActor and ScriptComponent. I’m pondering the possibility of specifying just about any Blueprintable base class and I’m definitely going to add it when I figure out the best way to do it. Cool thing is that you can basically use your ScriptComponent-derived components when designing ‘normal’ blueprints. Oh, and you should be able to specify the Lua generated Blueprints as base classes for normal Blueprints as well. It’s all Blueprint magic!

I really like the sounds of this, especially if you can get any Blueprintable base class working. That’s a feature I really want to see.

> [@](#):
>
> I’m planning to focus on user experience now. For now, Lua scripts are not automatically re-compiled and you need to double click on the class to open BP editor and click compile in there to do it. I also want to add the ability to have Lua scripts listed in generated projects in IDE (VS etc).

Is it possible to have the script plugin available in the editor (or maybe that already works)? For coffescipt, I just load the coffeescript compiler (written in JS) into V8, then when I get a coffeescript file, I call the compiler from C++ and get back the compiled JS source, which I then give back to V8 as a script. The other option is to use the external coffeescript compiler and launch that from the editor.

If the script plugin is in the editor, it leads to a scriptable editor as well, a nice feature. I’d love to be able to write extentions to the editor in JS and test them live.

Would it be possible to add startup and shutdown scripts? I want a startup script that’s independent of blueprint that I can run after the engine is started, but before my game code, to load the JS libraries I need. A shutdown script would be nice as well to handle any cleanup.

Another feature I’d like to see is the ability to manage scripts independent of blueprint. For library files, I want to be able to include them in any build wihtout attaching them to a blueprint script. Maybe this already exist as well.

---

<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:** [July 3, 2014, 7:29pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/51 "2014-07-03T19:29:36Z")

</div>

> [@;88805](#):
>
> I think we are really close to production-ready phase with this now.

Thanks for the update!!

---

<div class="post-metadata">

**Author:** ![robert.manuszewski](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@robert.manuszewski](https://forums.unrealengine.com/u/robert.manuszewski)\
**Post date:** [July 4, 2014, 7:15am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/52 "2014-07-04T07:15:45Z")

</div>

> [@jCoder;88954](#):
>
> Is it possible to have the script plugin available in the editor (or maybe that already works)? For coffescipt, I just load the coffeescript compiler (written in JS) into V8, then when I get a coffeescript file, I call the compiler from C++ and get back the compiled JS source, which I then give back to V8 as a script. The other option is to use the external coffeescript compiler and launch that from the editor.

Yeah, sure. If you look at the three script plugins that are needed for the integration, you’ll notice that there’s a ScriptGenratorPlugin: UnrealHeaderTool extension); ScriptPlugin: runtime, this is where scripts are executed, it also loads in the editor and ScriptEditorPlugin: script compiler, Blueprint Compiler and a specialized version of BlueprintEditor, so you can basically add any other editors you wish there too.

> [@jCoder;88954](#):
>
> Would it be possible to add startup and shutdown scripts? I want a startup script that’s independent of blueprint that I can run after the engine is started, but before my game code, to load the JS libraries I need. A shutdown script would be nice as well to handle any cleanup.

Yes. It’s totally up to you if you want to add something like that. What my plugins provide is FScritpContextBase (in Lua: FLuaContext : public FScriptContextBase) which is a base class for scripting integrations, a place where implementation specific scripts live and all script-derived Blueprints use that to execute actual script code. You could also use it as standalone thing to execute scripts wherever you like.

> [@jCoder;88954](#):
>
> Another feature I’d like to see is the ability to manage scripts independent of blueprint. For library files, I want to be able to include them in any build wihtout attaching them to a blueprint script. Maybe this already exist as well.

That’s going to be the FScriptContextBase as well.

---

<div class="post-metadata">

**Author:** ![robert.manuszewski](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@robert.manuszewski](https://forums.unrealengine.com/u/robert.manuszewski)\
**Post date:** [July 5, 2014, 12:45pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/53 "2014-07-05T12:45:02Z")

</div>

Ok, I found a way to support any class as base for scrip-generated classes. Now I can’t stop working on it and it’s Saturday! I blame you @jCoder!! 😛

---

<div class="post-metadata">

**Author:** ![hd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@hd](https://forums.unrealengine.com/u/hd)\
**Post date:** [July 5, 2014, 1:06pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/54 "2014-07-05T13:06:46Z")

</div>

Nice one !

---

<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:** [July 5, 2014, 2:36pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/55 "2014-07-05T14:36:23Z")

</div>

> [@;90048](#):
>
> Ok, I found a way to support any class as base for scrip-generated classes. Now I can’t stop working on it and it’s Saturday! I blame you @jCoder!! 😛

😉 I’m looking forward to what you come up with.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a7daa9ef](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a7daa9ef](https://forums.unrealengine.com/u/anonymous_user_a7daa9ef)\
**Post date:** [July 8, 2014, 3:56am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/56 "2014-07-08T03:56:11Z")

</div>

Great work! Are there plans to support UFunctions with TArray arguments? I updated to 4.3 wip and searched the generated .script code (for example) for:

> **[GetOverlappingActors](https://docs.unrealengine.com/5.2/en-US/API/Runtime/Engine/GameFramework/AActor/GetOverlappingActors/)**
>
> Overload list

But see no evidence of it…

Thanks!

---

<div class="post-metadata">

**Author:** ![robert.manuszewski](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@robert.manuszewski](https://forums.unrealengine.com/u/robert.manuszewski)\
**Post date:** [July 8, 2014, 1:46pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/57 "2014-07-08T13:46:18Z")

</div>

> [@jmkinzer;91634](#):
>
> Great work! Are there plans to support UFunctions with TArray arguments?

I started working on TArray support in general some time ago but decided to get the script-generated classes functionality in place first. I’ll try to come back to it this month.

---

<div class="post-metadata">

**Author:** ![Dannington](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dannington](https://forums.unrealengine.com/u/Dannington)\
**Post date:** [July 9, 2014, 3:13pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/58 "2014-07-09T15:13:26Z")

</div>

I’m very pleased to find this thread - it might be a lifesaver for me. When I got to this bit though:

_then re-generate projects and compile the engine. UBT should automatically pick this up and enable Lua integration._

I got a bit stuck. Could you tell me what to do here?

Other than that, could you give me an example of…

_In the default case where Lua is not enabled, SGP uses a generic script generator which exports simple wrapper functions around public class members._

I just need to get my toe in the door with regards to either of these (both of these) methods.

(Did you mention you had a blog? Where can I find it?)

Dan

---

<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:** [July 9, 2014, 3:24pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/59 "2014-07-09T15:24:08Z")

</div>

> [@Dannington;92451](#):
>
> I’m very pleased to find this thread - it might be a lifesaver for me. When I got to this bit though:
> 
> _then re-generate projects and compile the engine. UBT should automatically pick this up and enable Lua integration._
> 
> I got a bit stuck. Could you tell me what to do here?

1. If you haven’t done so, you need to download the 4.3 preview engine source.

2. Got to [Lua: download](http://www.lua.org/download.html) and download the latest source

3. Remove it from the archive (use 7zip or similar archive program) and put it in \Engine\Plugins\Script\ScriptPlugin\Source\ScriptPlugin\ in a folder called lua-5.2.3 If you do this right, in you should have a path at \Engine\Plugins\Script\ScriptPlugin\Source\ScriptPlugin\lua-5.2.3\src that contains the .c and .h source files for lua.

4. Run the GenerateProject.bat script that’s in the root folder of your engine source.

5. Rebuild the engine.

6. You should now have an engine that has Lua built-in and you can add scripts to blueprint objects in the editor.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a7daa9ef](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a7daa9ef](https://forums.unrealengine.com/u/anonymous_user_a7daa9ef)\
**Post date:** [July 9, 2014, 4:32pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/60 "2014-07-09T16:32:32Z")

</div>

> [@;91927](#):
>
> I started working on TArray support in general some time ago but decided to get the script-generated classes functionality in place first. I’ll try to come back to it this month.

Excellent, looking forward to it. Thanks!

---

<div class="post-metadata">

**Author:** ![Dannington](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dannington](https://forums.unrealengine.com/u/Dannington)\
**Post date:** [July 9, 2014, 10:28pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/61 "2014-07-09T22:28:34Z")

</div>

Hi jCoder - have you done anything interesting with this yet? I’m really trying to implement some kind of IP socket listener but my c++ sucks so much I’ll never get it done. Could it be done with this do you think?

I’m also trying to grab assets into arrays from paths but have had no luck with that either.

Dan.

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

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