Adding Lua Scripts to Component Entities
O3DE makes it easy for you to add script functionality to your game entities by using the Lua Script component. The following steps show you how to do this in O3DE Editor.
To add a Lua script to a component entity in O3DE Editor
With the Entity Outliner view pane visible, left-click the entity that you want to add a Lua script to.
Click Add Component, in the
Scriptingcategory of the drop-down menu, select Lua Script.
A Lua Script component appears in Entity Inspector. Click the file select button to select the Lua script from the file hierarchy that you want to use.Note:You can select either a
.luafile (a text copy of the original), or a
.luacfile (a precompiled version of the script). The functionality should be the same. The precompiled version is preferable because it loads faster and is usually smaller. However, you can use
.luafiles if you experience any issues.
After the script is loaded, click to launch Lua Editor and make changes to your script.