Version:

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.4 .

Lua Editor and Debugging

The Lua development environment in O3DE includes the Lua Editor. The debugger that is included with the Lua Editor uses AzNetworking connections managed by AzFramework’s TargetManagement.

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.