Writing Lua Scripts in Open 3D Engine

You can use Lua in Open 3D Engine (O3DE) to facilitate quick iteration of your game project. Lua is a powerful, fast, lightweight, embeddable scripting language. When you construct new gameplay and game systems, you can run your changes immediately, without compiling your source code.

O3DE uses Lua version 5.3 .

Lua Editor and GridHub

The Lua development environment in O3DE includes the Lua Editor. The debugger that is included with the Lua Editor uses a connection hub called GridHub. These two applications are built when the O3DE Editor is built.

Building Lua Editor and GridHub

To build Lua Editor and GridHub separately, navigate to the directory where you build your project (or where you build the O3DE engine, if you build the engine separately) and run the following command, inserting the path to your build directory.

cmake --build <build-directory> --target LuaIDE GridHub --config profile -- -m

Learning Lua

For learning the Lua language itself, the lua.org website is a good place to start.

Learning Lua in O3DE

After you read through this tutorial on writing Lua scripts for the component entity system, learn more about using Lua in O3DE by consulting the following resources.

Section topics

TopicDescription
Adding Lua Scripts to Component EntitiesUse the Lua Script component to add script functionality to your game entities.
Lua Script StructureBasic structure of a Lua script.
Lua EditorLearn about the Lua Editor.
Properties TableSpecify the properties of a Lua script component that appear in O3DE Editor.
Using EBuses in LuaWrite Lua scripts that use the EBus to communicate between components.
The Lua Environment (Advanced)Learn about adding ScriptContext instances and using common code in the O3DE Lua environment.
Debugging Lua ScriptsLearn about debugging Lua scripts in O3DE.
Debugging with Lua EditorUse Lua Editor to debug Lua scripts.
TopicDescription
Camera ComponentUse the Camera component to allow an entity to be used as a camera.
Using Player InputWork with the Input component in O3DE.
Input Component Event Bus InterfaceWork with the Input component EBus (event bus).
AWS Client Auth ScriptingExamples of using the AWS Client Auth Gem with Script Canvas and Lua.
AWS Metrics ScriptingExamples of using Script Canvas or Lua with the AWS Metrics Gem to generate and submit metrics.
Gestures GemThe Gestures Gem provides detection for common gesture-based input actions.
Virtual Gamepad GemThe Virtual Gamepad Gem provides controls that emulate a gamepad on touch screen devices for O3DE projects.
Tweener Lua ScriptLearn how to use Lua scripting to animate your entities with the Scripted Entity Tweener system.
Tweener TimelineUse Scripted Entity Tweener’s timeline abilities to chain animations together and exert fine control over them.
Synchronizing Animation GraphsUse synchronized animation graphs to synchronize animation between actors.

Copyright © 2022 Open 3D Engine Contributors

Documentation Distributed under CC BY 4.0.
For our trademark, privacy and antitrust policies, code of conduct, and terms of use, please click the applicable link below or see https://www.lfprojects.org.


The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Policy page.