Lua Programming in the Godot Game Engine

One of the strengths of the open source Godot Game Engine, is the ability to develop in different programming languages, including the popular Lua scripting language. In the past we looked at the programming language options when working with Godot and today we are going to be looking at a recently update, incredibly easy to use implementation of Lua called godot-lua-pluginscript. If you are new to the Lua scripting language, be sure to check out our GameDev For Complete Beginners tutorial series, which contains a complete step by step primer to learning Lua.

Godot Lua PluginScript is described as:

GDNative + PluginScript library that adds support for Lua as a scripting language in Godot.

Being a GDNative library, recompiling the engine is not required, so anyone with a built release copied to their project can use it. Being a PluginScript language, Lua can seamlessly communicate with scripts written in GDScript / C# / Visual Script and vice-versa. This way, one can use the language that best suits the implementation for each script and all of them can understand each other.

For some usage examples, check out lps_coroutine.lua and plugin/lua_repl.lua.

Currently, only LuaJIT is supported, since the implementation is based on its FFI library.

The project is open source under the MIT license with a manual and reference materials available here. Since it is implemented using GDNative, installation is as simple as adding the release downloads addons folder to your project and restarting Godot. The obscenely simple code example used in the video is as follows:

local Loo = {
	extends = "Sprite",
}
function Loo:_ready()
	print("ready")
end
function Loo:_process(dt)
	self:move_local_x(1)
end
return Loo

You can check out Lua support in the Godot game engine in action in the video below.

Scroll to Top