Built platforms: Windows, Linux, macOS, iOS, Android, Web
Added
- Support for constructing typed arrays in Lua using the idiom
Array[some_type]() - Support for constructing typed dictionaries in Lua using the idiom
Dictionary[key_type][value_type]() - Support for typed arrays, typed dictionaries and classes in exported properties:
MyScript.exported_node_array = export(Array[Node]) MyScript.exported_int_valued_dict = export(Dictionary[Variant][int]) MyScript.exported_texture_property = export(Texture) -- or MyScript.exported_node_array = export({ type = Array[Node] }) MyScript.exported_int_valued_dict = export({ type = Dictionary[Variant][int] }) MyScript.exported_texture_property = export({ type = Texture })
is_instance_validutility function when openingGODOT_UTILITY_FUNCTIONSlibrary- Support for older Linux distros using GLIBC on par with Ubuntu 22.04
- Parser API based on Tree Sitter
- Adds the
LuaParser,LuaAST,LuaASTNodeandLuaASTQueryclasses
- Adds the
Changed
LuaScriptInstance's data table is passed asselfto methods instead of their ownerObject- For this to work, the table now has a metatable to access its owner when necessary
LuaScripts now have a "Import Behavior" property, defaulting to "Automatic"- In "Automatic" behavior, Lua code is evaluated only if it looks like a Godot script.
Lua code that looks like a Godot script is one that ends by returning a named variable (return MyClassVariable) or a table constructed inline (return {...}) - In "Always Evaluate" behavior, Lua code will always be evaluated
- In "Don't Load" behavior, Lua code will not be loaded nor evaluated at all
- Note that only evaluated scripts can be attached to Godot Objects.
- In "Automatic" behavior, Lua code is evaluated only if it looks like a Godot script.
- Variant and
LuaScriptInstancemethods are now converted to Callable, so they can be more easily passed to Godot APIs such asSignal.connect-- Before this change, we had to manually instantiate Callable some_signal:connect(Callable(self, "method_name")) -- Now we can pass the method directly some_signal:connect(self.method_name)
Fixed
- Fixed cyclic references from
LuaScriptInstance<->LuaState, avoiding leaks ofLuaScripts - Fixed cyclic references from
LuaScriptProperty<->LuaState, avoiding memory leaks - Support for built-in Variant types in exported properties when passed directly to
export:MyScript.exported_dictionary = export(Dictionary)
- Convert null Object Variants (
<Object#null>) tonilwhen passing them to Lua - Convert freed Object Variants (
<Freed Object>) tonilwhen passing them to Lua - Fixed
LuaJIT core/library version mismatcherrors in LuaJIT builds LuaScriptResourceFormatLoader::_loadnow respects the cache mode, fixing "Another resource is loaded from path 'res://...' (possible cyclic resource inclusion)." errors- Error messages from Lua code using the wrong stack index
- Crashes when passing Lua primitives to
typeof,Variant.is,Variant.get_type,Variant.booleanize,Variant.duplicate,Variant.get_type_name,Variant.hash,Variant.recursive_hashandVariant.hash_compare - The
addons/lua-gdextension/build/.gdignorefile was added to the distributed build.
This fixes import errors when opening the Godot editor with the LuaJIT build.