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

<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 18, 2014, 5:23pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/82 "2014-07-18T17:23:09Z")

</div>

> [@BenFreidlin;99334](#):
>
> Also, is there a doc somewhere that shows a quick start to doing Hello World with Lua in UE4? I may have missed it, but I can’t find anything showing how to get this working. Also, is there a list of all Lua exposed classes/functions? Would be handy to have this rather than digging around source for those exports.

I posted [this message above](https://forums.unrealengine.com/showthread.php?3958-Scripting-Language-extensions-via-plugins&p=92457&viewfull=1#post92457), just change 4.3 Preview to 4.3 release. That will get you a build of the engine with Lua support. I don’t think Robert has documented anything yet, other then this thread, so you have to dig in the source to find out what’s exported.

---

<div class="post-metadata">

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

</div>

Thanks all for the answers. One other question, how are people debugging Lua within UE4? Any plans to support its debugging extensions with a slick but simple little IDE window that could be pulled up? That would be some killer feature right there.

---

<div class="post-metadata">

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

</div>

> [@jCoder;99345](#):
>
> I posted [this message above](https://forums.unrealengine.com/showthread.php?3958-Scripting-Language-extensions-via-plugins&p=92457&viewfull=1#post92457), just change 4.3 Preview to 4.3 release. That will get you a build of the engine with Lua support. I don’t think Robert has documented anything yet, other then this thread, so you have to dig in the source to find out what’s exported.

Are you saying that the script work that’s been done is not in the official 4.3 release? If so, why would it be in the source code? I’m confused. Which source should be downloaded and rebuilt?

---

<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 19, 2014, 1:38am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/85 "2014-07-19T01:38:33Z")

</div>

> [@BenFreidlin;99474](#):
>
> Are you saying that the script work that’s been done is not in the official 4.3 release? If so, why would it be in the source code? I’m confused. Which source should be downloaded and rebuilt?

I’ve updated the earlier post below. The script plugin is in 4.3.0 Release source code, in the Engine/Plugins directory. I don’t think it’s been compiled into the 4.3.0 binary release. You have to compile it yourself.

1. If you haven’t done so, you need to download the 4.3 0 Release source code from [https://github.com/EpicGames/UnrealEngine/releases/tag/4.3.0-release](https://github.com/EpicGames/UnrealEngine/releases/tag/4.3.0-release)

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

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:** ![enlight\_2014](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@enlight\_2014](https://forums.unrealengine.com/u/enlight_2014)\
**Post date:** [July 19, 2014, 5:59am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/86 "2014-07-19T05:59:39Z")

</div>

> [@jCoder;99487](#):
>
> The script plugin is in 4.3.0 Release source code, in the Engine/Plugins directory. I don’t think it’s been compiled into the 4.3.0 binary release. You have to compile it yourself.

It’s not that the plugin hasn’t been compiled into the binary release of the engine, it’s that it hasn’t been compiled with Lua enabled. Without Lua enabled the code generator plugin will still generate sample glue code that you can find under Engine/Intermediate/Build/Win64/Inc/Plugins/ScriptPlugin, this also addresses an earlier question about what is currently being exposed to Lua, there’s a generated .script.h in that directory for every class that’s exported.

---

<div class="post-metadata">

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

</div>

Is it accurate to say that anything that Blueprint can access in UE4, Lua can access as well? Isn’t BP relying on UPROPERTY and UFUNCTION?

---

<div class="post-metadata">

**Author:** ![iniside](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/iniside/32/866315_2.png) [@iniside](https://forums.unrealengine.com/u/iniside)\
**Post date:** [July 19, 2014, 7:40pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/88 "2014-07-19T19:40:21Z")

</div>

> [@BenFreidlin;99843](#):
>
> Is it accurate to say that anything that Blueprint can access in UE4, Lua can access as well? Isn’t BP relying on UPROPERTY and UFUNCTION?

UPROPERTY, UFUNCTION and other Macros, decorations, are used to create code reflection. So whatever is exposed to code reflection should be accessible, for any other system, which can take advantage of it.

---

<div class="post-metadata">

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

</div>

> [@jCoder;99487](#):
>
> I’ve updated the earlier post below. The script plugin is in 4.3.0 Release source code, in the Engine/Plugins directory. I don’t think it’s been compiled into the 4.3.0 binary release. You have to compile it yourself.
> 
> 1. If you haven’t done so, you need to download the 4.3 0 Release source code from [https://github.com/EpicGames/UnrealEngine/releases/tag/4.3.0-release](https://github.com/EpicGames/UnrealEngine/releases/tag/4.3.0-release)
> 
> 2. Got to [Lua: download](http://www.lua.org/download.html) and download the latest source (version 5.2.3)
> 
> 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.

I’m getting this link error: Error 1 error LNK2005: main already defined in lua.c.obj UnrealEngine-4.3\Engine\Intermediate\ProjectFiles\luac.c.obj

Obviously there’s a main already defined in the editor target. Shouldn’t the main in lua be commented out since we aren’t using it? Is there any patch needed here?

---

<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:** [July 20, 2014, 4:19am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/90 "2014-07-20T04:19:33Z")

</div>

> [@BenFreidlin;99967](#):
>
> I’m getting this link error: Error 1 error LNK2005: main already defined in lua.c.obj UnrealEngine-4.3\Engine\Intermediate\ProjectFiles\luac.c.obj
> 
> Obviously there’s a main already defined in the editor target. Shouldn’t the main in lua be commented out since we aren’t using it? Is there any patch needed here?

Quoting the relevant bit from Robert’s first post in this thread:

> [@;25369](#):
>
> If you want to test how it works, the only thing you need to do is to download Lua source code and copy the entire lua-5.2.3 folder **(except luac.c)** into Engine/Plugins/Script/ScriptPlugin/Source/ScriptPlugin, then re-generate projects and compile the engine.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bc6e5451](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bc6e5451](https://forums.unrealengine.com/u/anonymous_user_bc6e5451)\
**Post date:** [July 20, 2014, 1:36pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/91 "2014-07-20T13:36:24Z")

</div>

Very creative.Thank’s for this.

---

<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:** [July 20, 2014, 4:28pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/92 "2014-07-20T16:28:28Z")

</div>

I’m experiencing two issues here:

I successfully compiled the engine and editor with Lua, however, I don’t see any ScriptActor or ScriptComponents in the editor to create.

The Plugin appears to be making the game run in simulator mode, even when simulation isn’t turned on. I know this because I have some C++ code that puts my actors in certain locations and it started doing that when I opened the project despite not running the simulator.

Edit:

I think I may have found a script component, I attached a script to it though, and I’m not really sure how to be able to see any of these variables in the editor, or blueprints as they don’t show up in either, though I know the integration is working because I do get the print statements in my log. Also, I only see a ‘Script Test Actor’, not a Script Actor.

---

<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 21, 2014, 6:56pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/93 "2014-07-21T18:56:00Z")

</div>

Just drag and drop a lua script (a file with .lua extension) into the content browser. It will ask you for a base class for it (just like Blueprints), you can pick any class you want. The only special class is ScriptComponent that should be used for creating Lua components but only because it’s the only way you can have a Tick function for a component in Lua.

I’ll try to write up some docs soon.

---

<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 21, 2014, 6:58pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/94 "2014-07-21T18:58:13Z")

</div>

And to answer one of the previous questions: Lua plugin is still in ‘early access’ phase, so we’re committed to developing it but since development is not yet complete, we don’t fully support it. However, I’d say we have the experimental stage behind us and we’re going to be adding workflow improvements and new features from now on.

---

<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:** [July 22, 2014, 12:08am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/95 "2014-07-22T00:08:47Z")

</div>

> [@;101289](#):
>
> Just drag and drop a lua script (a file with .lua extension) into the content browser. It will ask you for a base class for it (just like Blueprints), you can pick any class you want. The only special class is ScriptComponent that should be used for creating Lua components but only because it’s the only way you can have a Tick function for a component in Lua.
> 
> I’ll try to write up some docs soon.

Is this only in the latest preview and not 4.3? That may be my issue, as I noticed the latest preview has more code commits. When I drag it in at 4.3 it just becomes an asset with no option to choose a base class.

Also, I don’t know how hard this would be , but it would be awesome if we had a simple text edit within the editor to make hot fixes to the Lua scripts. It doesn’t need syntax highlighting or anything, just a way to make quick changes or add prints for debugging. Currently the work flow is a little annoying for a scripting language, you need to edit outside of the editor, then reimport, which isn’t too bad, but it could be even better!

---

<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 22, 2014, 11:17am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/96 "2014-07-22T11:17:20Z")

</div>

It’s not in the pre-built binaries, but if you compile the engine with Lua source code copied to the plugin folder as described in one of the previous posts, it should work.

Built-in editor is something we’ve been discussing recently.

---

<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:** [July 23, 2014, 2:03am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/97 "2014-07-23T02:03:00Z")

</div>

> [@;101927](#):
>
> It’s not in the pre-built binaries, but if you compile the engine with Lua source code copied to the plugin folder as described in one of the previous posts, it should work.
> 
> Built-in editor is something we’ve been discussing recently.

Thats great to hear. I compiled the 4.3 engine on github, ill try again.

---

<div class="post-metadata">

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

</div>

> [@;101927](#):
>
> It’s not in the pre-built binaries, but if you compile the engine with Lua source code copied to the plugin folder as described in one of the previous posts, it should work.
> 
> Built-in editor is something we’ve been discussing recently.

Built in editor with syntax highlighting and debugger would be killer. Is it votable in the roadmap site?

---

<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:** [July 24, 2014, 4:55am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/99 "2014-07-24T04:55:00Z")

</div>

> [@;101927](#):
>
> It’s not in the pre-built binaries, but if you compile the engine with Lua source code copied to the plugin folder as described in one of the previous posts, it should work.
> 
> Built-in editor is something we’ve been discussing recently.

Using 4.3 release on github, if I try to import I don’t get any prompt to parent, and if I right click the ‘Create Blueprint using…’ is greyed out. Its a .lua file type.

---

<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 24, 2014, 9:09am UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/100 "2014-07-24T09:09:54Z")

</div>

Ah, Sorry! Just looked at the dates of my check-ins. It’s in Master branch only for now. It missed the 4.3 branch date by a day or two ☹ I guess you need to wait for 4.4 if you don’t want to get the master branch.

---

<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 24, 2014, 12:22pm UTC](https://forums.unrealengine.com/t/scripting-language-extensions-via-plugins/3542/101 "2014-07-24T12:22:46Z")

</div>

> [@BenFreidlin;103167](#):
>
> Built in editor with syntax highlighting and debugger would be killer. Is it votable in the roadmap site?

Not yet, but you can vote on ‘Script Plugin Improvements’. If that gets more votes, everything related will too.

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

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