9.6 KiB
9.6 KiB
Changelog
Unreleased
0.6.0
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.
Lua code that looks like a Godot script is one that ends by returning a named variable (
- 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.
0.5.0
Added
- Support for Linux arm64
LuaTable.get_metatableandLuaTable.set_metatablemethods- Support for building with LuaJIT
LuaState.get_lua_runtime,LuaState.get_lua_version_numandLuaState.get_lua_version_stringmethods
0.4.0
Added
LuaCoroutine.completedandLuaCoroutine.failedsignalsawaitfunction similar to GDScript's, allowing coroutines to yield and resume automatically when a signal is emitted- Support for Web exports
- Support for Windows arm64
- Support for calling static methods from Godot classes, like
FileAccess.open - Custom Lua 5.4+ warning function that sends messages to
push_warning LuaThreadclass as a superclass forLuaCoroutine. This new class is used when converting a LuaState's main thread to Variant.LuaState.main_threadproperty for getting a Lua state's main thread of execution- Support for setting hooks to
LuaThreads, including the main thread
Changed
LuaObjectinstances are reused when wrapping the same Lua object, so that==andis_samecan be used properly- The following methods of LuaScripts run in pooled coroutines, so that
awaitcan be used in them: regular method calls, setter functions,_init,_notification - Godot 4.4 is now the minimum version necessary to use this addon
Fixed
- Use
xcframeworkinstead ofdylibin iOS exports - Crash when Lua errors, but the error object is not a string
- Crash when reloading the GDExtension
0.3.0
Added
- Editor plugin that registers the Lua REPL tab, where you can try Lua code using an empty
LuaState - Support for calling Godot String methods using Lua strings
- Optional support for
res://anduser://relative paths in package searchers,loadfileanddofile. Open theGODOT_LOCAL_PATHSlibrary to activate this behavior. LuaState.LoadModeenum for specifying the Lua load mode: text, binary or anyLuaState.do_bufferandLuaState.load_buffermethods for loading Lua code from possibly binary chunksLuaState.package_pathandLuaState.package_cpathproperties for accessing the value of Lua'spackage.pathandpackage.cpathLuaState.get_lua_exec_dirstatic method to get the executable directory used to replace "!" when settingpackage_pathandpackage_cpathproperties. When running in the Godot editor, it returns the globalized version ofres://path. Otherwise, it returns the base directory of the executable.- Advanced project settings for setting the
LuaScriptLanguagestate'spackage_pathandpackage_cpathproperties LuaState.are_libraries_openedmethod for checking if a subset of libraries were already openedLuaState.create_functionmethod for creating aLuaFunctionfrom aCallable- API documentation is now available in the Godot editor
Changed
- The GDExtension is now marked as reloadable
- Renamed
LuaCoroutine::LuaCoroutineStatustoLuaCoroutine::Status LuaState.load_fileandLuaState.do_filenow receive the load mode instead of buffer sizeCallablevalues when passed to Lua are wrapped as Lua functions whenGODOT_VARIANTlibrary is not opened, making it possible to call them in sandboxed environments- Lua is now compiled as C++
Removed
VariantType::has_static_methodinternal method
Fixed
- Bind
LuaCoroutine::statusproperty with correct enum type - Bind
LuaError::statusproperty as int with correct enum type - Crash when calling utility functions from Lua
- Compilation for Windows using MSVC
0.2.0
Added
- Lua is now available as a scripting language for Godot objects, so that you can create your games entirely in Lua!
LuaObject.get_lua_statemethod for getting theLuaStateof a Lua objectLuaTable.clearmethodLuaTable.rawgetandLuaTable.rawsetmethods that don't trigger metamethodsLuaFunction.to_callablemethod to easily turn Lua functions to CallableLuaState.load_stringandLuaState.load_filesfor loading Lua code without executing it- Support for passing a
LuaTableas_ENVinLuaState.do_stringandLuaState.do_file - Support for
PackedVector4Arrayvariant type - "Bouncing Logo" sample scene
Changed
- Minimum Godot version supported is now 4.3
- Android target API changed to 21 (Android Lollipop 5.0)
- In Lua,
printis now bound to Godot'sprinttto match Lua's behavior of adding\tbetween passed arguments
Removed
LuaTable.get_valueandLuaTable.set_value, useLuaTable.getandLuaTable.setinstead
Fixed
- Use
PROPERTY_USAGE_NONEforLuaState.globalsandLuaState.registry, fixing instance leaks - Lua stack handling in
LuaTableand utility function wrapper code, fixing crashes typeofutility function now returns aVariantTypeinstead of a value unusable by Lua- Lua objects coming from a different
LuaStateare passed as Variants to Lua instead of being unwrapped, fixing crashes
0.1.0
Added
LuaStateclass for holding a Lua state and interacting with it. You may create as many instances as you want, each one representing an independent Lua state.LuaCoroutine,LuaFunction,LuaLightUserdata,LuaTableandLuaUserdataclasses that wrap instances from a Lua state in Godot.LuaErrorclass that represents errors from Lua code.- Support for registering
Varianttype in Lua states, so that any Godot data can be manipulated in Lua. - Support for registering Godot classes in Lua, so you can create instances and access integer constants.
- Support for adding access to Godot singleton objects in Lua, accessible directly by name.
- Support for registering Godot utility functions in Lua, like
print,lerpandis_same. - Support for adding access to Godot global enums in Lua, like
OK,TYPE_STRINGandSIDE_LEFT.