Godot 4 support #50
gilzoide
announced in
Announcements
Replies: 2 comments 2 replies
-
Wow, sounds pretty awesome! Right now, is the Godot 4 API complete in the realm of custom scripting languages or does it still have a few drawbacks? |
Beta Was this translation helpful? Give feedback.
2 replies
-
this is so cool! i hope all goes well and u dont run into any roadblocks |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi folks!
I've already talked in some issues about how Lua PluginScript works on Godot 3.X only, since GDNative was replaced by GDExtension in Godot 4. I've been studying GDExtension lately and came up with a plan for Lua scripting support in Godot 4 using the new system. Since it will require a full rewrite 😅, I've decided to let this repository stay with the GDNative code only and create a new one for the GDExtension-compatible solution.
So I'd like to present to you the new project, Lua GDExtension 🎉
It is also free and open source software hosted at GitHub, check it out: https://github.com/gilzoide/lua-gdextension
So that you know, this time I'm going for a different approach: instead of using LuaJIT + FFI, we'll be using C++, godot-cpp, and Sol. This approach is interesting because any Lua implementation can be used, including standard PUC-Rio Lua 5.4, LuaJIT and even languages that compile to Lua like MoonScript and Yuescript.
The first step, which is right now a work in progress, is making a Godot-compatible class for creating Lua states and interacting with them, even from GDScript and C# code, much like WeaselGames/godot_luaAPI does. Using
Sol
makes wrapping Godot Variant classes quite a breeze, which is totally awesome!Only after having full featured Lua bindings with access to all built-in Godot Variant data types, we'll implement the ScriptLanguageExtension that will enable Lua as a scripting language in Godot.
This choice was based on the requirement of implementing the
ScriptLanguageExtension
subclass. I don't know about you, but it makes sense to me that we should have a Godot-readyLuaState
class that the extension will itself use to implement the "Lua as a scripting language" support.This abstracts away the Lua <-> Godot communication from the scripting language support, so that people can use both functionalities independent of each other and making the code more modular.
As a bonus, the scripting language extension could itself be extendable, so that support for Lua dialects like
MoonScript
can be added with a simple method overwrite for reading the script and outputting Lua code. The default implementation will just return the Lua code itself without any transformation/compilation.Now, this will take time until it's usable, of course, but I'm pretty sure it's totally doable in a reasonable time!
I'll keep you posted in this thread when it reaches the first milestone, but be sure to check out the new repository and its own Discussions and Project boards!
Cheers! 🍾
gilzoide
Beta Was this translation helpful? Give feedback.
All reactions