Skip to content

Commit c329763

Browse files
committed
Merge branch 'main' into feature/linux-arm
2 parents a3eb03c + 6ef7a05 commit c329763

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1373
-135
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ indent_size = 4
2222
[Makefile]
2323
indent_style = tab
2424
indent_size = 8
25+
26+
[doc_classes/*.xml]
27+
indent_style = tab
28+
indent_size = 4

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
# Changelog
2-
## [Unreleased](https://github.com/gilzoide/lua-gdextension/compare/0.3.0...HEAD)
2+
## [Unreleased](https://github.com/gilzoide/lua-gdextension/compare/0.4.0...HEAD)
3+
4+
5+
## [0.4.0](https://github.com/gilzoide/lua-gdextension/releases/tag/0.4.0)
36
### Added
47
- `LuaCoroutine.completed` and `LuaCoroutine.failed` signals
58
- `await` function similar to GDScript's, allowing coroutines to yield and resume automatically when a signal is emitted
69
- Support for Web exports
710
- Support Windows arm64 exports
11+
- Support for calling static methods from Godot classes, like `FileAccess.open`
12+
- Custom [Lua 5.4+ warning function](https://www.lua.org/manual/5.4/manual.html#lua_setwarnf) that sends messages to `push_warning`
13+
- `LuaThread` class as a superclass for `LuaCoroutine`.
14+
This new class is used when converting a LuaState's main thread to Variant.
15+
- `LuaState.main_thread` property for getting a Lua state's main thread of execution
16+
- Support for setting hooks to `LuaThread`s, including the main thread
817

918
### Changed
1019
- `LuaObject` instances are reused when wrapping the same Lua object, so that `==` and `is_same` can be used properly
@@ -13,6 +22,8 @@
1322

1423
### Fixed
1524
- Use `xcframework` instead of `dylib` in iOS exports
25+
- Crash when Lua errors, but the error object is not a string
26+
- Crash when reloading the GDExtension
1627

1728

1829
## [0.3.0](https://github.com/gilzoide/lua-gdextension/releases/tag/0.3.0)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Lua GDExtension
2-
[![Godot Asset Library page](https://img.shields.io/static/v1?logo=godotengine&label=asset%20library&color=478CBF&message=0.3.0)](https://godotengine.org/asset-library/asset/2330)
2+
[![Godot Asset Library page](https://img.shields.io/static/v1?logo=godotengine&label=asset%20library&color=478CBF&message=0.4.0)](https://godotengine.org/asset-library/asset/2330)
33
[![Build and Test workflow](https://github.com/gilzoide/lua-gdextension/actions/workflows/build.yml/badge.svg)](https://github.com/gilzoide/lua-gdextension/actions/workflows/build.yml)
44

55
<img src="addons/lua-gdextension/icon.png" alt="Lua GDExtension icon" width="150" height="150"/>
66

7-
Extension for using the [Lua programming language](https://www.lua.org/) in Godot 4.3+
7+
Extension for using the [Lua programming language](https://www.lua.org/) in Godot 4.4+
88

99
With this addon, you can program your game or application directly in Lua.
1010
You can also create sandboxed Lua states for external modding/scripting support, as many as necessary.

addons/lua-gdextension/plugin.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
name="Lua GDExtension"
44
description="Tools for Lua GDExtension: REPL tab"
55
author="gilzoide"
6-
version="0.3.0"
6+
version="0.4.0"
77
script="plugin.gd"

doc_classes/LuaCodeEdit.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<class name="LuaCodeEdit" inherits="CodeEdit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/godotengine/godot/master/doc/class.xsd">
3+
<brief_description>
4+
A CodeEdit subclass with sane defaults for [member CodeEdit.delimiter_comments] and [member CodeEdit.delimiter_strings] for Lua code.
5+
</brief_description>
6+
<description>
7+
</description>
8+
<tutorials>
9+
</tutorials>
10+
</class>

doc_classes/LuaCoroutine.xml

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
2-
<class name="LuaCoroutine" inherits="LuaObject" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/godotengine/godot/master/doc/class.xsd">
2+
<class name="LuaCoroutine" inherits="LuaThread" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/godotengine/godot/master/doc/class.xsd">
33
<brief_description>
44
A Lua coroutine object that allows cooperative multitasking in Lua scripts.
55
</brief_description>
@@ -59,48 +59,20 @@
5959
</description>
6060
</method>
6161
</methods>
62-
<members>
63-
<member name="status" type="int" setter="" getter="get_status" enum="LuaCoroutine.Status">
64-
The current status of the coroutine.
65-
</member>
66-
</members>
6762
<signals>
6863
<signal name="completed">
6964
<param index="0" name="result" type="Variant" />
7065
<description>
71-
Emitted when the coroutine completes execution with success and is in the STATUS_DEAD status.
72-
Coroutines that complete cannot be resumed anymore.
66+
Emitted when the coroutine completes execution with success and is in the STATUS_DEAD status.
67+
Coroutines that complete cannot be resumed anymore.
7368
</description>
7469
</signal>
7570
<signal name="failed">
7671
<param index="0" name="error" type="LuaError" />
7772
<description>
78-
Emitted when the coroutine completes execution with error and is in one of the error statuses.
79-
Coroutines that fail cannot be resumed anymore.
73+
Emitted when the coroutine completes execution with error and is in one of the error statuses.
74+
Coroutines that fail cannot be resumed anymore.
8075
</description>
8176
</signal>
8277
</signals>
83-
<constants>
84-
<constant name="STATUS_OK" value="0" enum="Status">
85-
The coroutine is running normally.
86-
</constant>
87-
<constant name="STATUS_YIELD" value="1" enum="Status">
88-
The coroutine is suspended (yielded).
89-
</constant>
90-
<constant name="STATUS_ERRRUN" value="2" enum="Status">
91-
A runtime error occurred in the coroutine.
92-
</constant>
93-
<constant name="STATUS_ERRSYNTAX" value="3" enum="Status">
94-
A syntax error occurred in the coroutine.
95-
</constant>
96-
<constant name="STATUS_ERRMEM" value="4" enum="Status">
97-
A memory allocation error occurred in the coroutine.
98-
</constant>
99-
<constant name="STATUS_ERRERR" value="5" enum="Status">
100-
An error occurred while running the error handler.
101-
</constant>
102-
<constant name="STATUS_DEAD" value="-1" enum="Status">
103-
The coroutine has finished execution.
104-
</constant>
105-
</constants>
10678
</class>

doc_classes/LuaDebug.xml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<class name="LuaDebug" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/godotengine/godot/master/doc/class.xsd">
3+
<brief_description>
4+
A structure used to carry different pieces of information about a Lua function or an activation record.
5+
</brief_description>
6+
<description>
7+
See [url]https://www.lua.org/manual/5.4/manual.html#lua_Debug[/url].
8+
</description>
9+
<tutorials>
10+
</tutorials>
11+
<methods>
12+
<method name="is_tail_call" qualifiers="const">
13+
<return type="bool" />
14+
<description>
15+
Returns [code]true[/code] if this function invocation was called by a tail call. In this case, the caller of this level is not in the stack.
16+
</description>
17+
</method>
18+
<method name="is_vararg" qualifiers="const">
19+
<return type="bool" />
20+
<description>
21+
Returns [code]true[/code] if the function is a variadic function (always true for C functions).
22+
</description>
23+
</method>
24+
</methods>
25+
<members>
26+
<member name="current_line" type="int" setter="" getter="get_current_line">
27+
The current line where the given function is executing. When no line information is available, current_line is set to -1.
28+
</member>
29+
<member name="event" type="int" setter="" getter="get_event" enum="LuaThread.HookEvent">
30+
Hook event that generated this activation record. Only meaningful during hooks.
31+
</member>
32+
<member name="last_line_defined" type="int" setter="" getter="get_last_line_defined">
33+
The line number where the definition of the function ends.
34+
</member>
35+
<member name="line_defined" type="int" setter="" getter="get_line_defined">
36+
The line number where the definition of the function starts.
37+
</member>
38+
<member name="name" type="String" setter="" getter="get_name">
39+
A reasonable name for the given function. Because functions in Lua are first-class values, they do not have a fixed name: some functions can be the value of multiple global variables, while others can be stored only in a table field. If Lua cannot find a name, then name is empty.
40+
</member>
41+
<member name="name_what" type="String" setter="" getter="get_name_what">
42+
Explains the name field. The value of name_what can be "global", "local", "method", "field", "upvalue", or "" (the empty string), according to how the function was called. (Lua uses the empty string when no other option seems to apply.)
43+
</member>
44+
<member name="nparams" type="int" setter="" getter="get_nparams">
45+
The number of parameters of the function (always 0 for C functions).
46+
</member>
47+
<member name="short_src" type="String" setter="" getter="get_short_src">
48+
A "printable" version of source, to be used in error messages.
49+
</member>
50+
<member name="source" type="String" setter="" getter="get_source">
51+
The source of the chunk that created the function. If source starts with a '@', it means that the function was defined in a file where the file name follows the '@'. If source starts with a '=', the remainder of its contents describes the source in a user-dependent manner. Otherwise, the function was defined in a string where source is that string.
52+
</member>
53+
<member name="what" type="String" setter="" getter="get_what">
54+
The string "Lua" if the function is a Lua function, "C" if it is a C function, "main" if it is the main part of a chunk.
55+
</member>
56+
</members>
57+
</class>

doc_classes/LuaFunction.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
<tutorials>
1111
</tutorials>
1212
<methods>
13+
<method name="get_debug_info" qualifiers="const">
14+
<return type="LuaDebug" />
15+
<description>
16+
Get the debug information available about this function.
17+
</description>
18+
</method>
1319
<method name="invoke" qualifiers="const vararg">
1420
<return type="Variant" />
1521
<description>

doc_classes/LuaState.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@
184184
Returns the _G table of the LuaState.
185185
The _G table is the global table accessible to Lua scripts.
186186
</member>
187+
<member name="main_thread" type="LuaThread" setter="" getter="get_main_thread">
188+
The main thread of execution of the LuaState.
189+
</member>
187190
<member name="package_cpath" type="String" setter="set_package_cpath" getter="get_package_cpath">
188191
The search path for Lua C extension modules. Equivalent to Lua's [code]package.cpath[/code] variable.
189192
When you use the [code]require[/code] function to load a C extension module, Lua searches the paths defined in [code]package.cpath[/code].
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<class name="LuaSyntaxHighlighter" inherits="CodeHighlighter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/godotengine/godot/master/doc/class.xsd">
3+
<brief_description>
4+
A CodeHighlighter subclass specialized for Lua code highlighting.
5+
</brief_description>
6+
<description>
7+
</description>
8+
<tutorials>
9+
</tutorials>
10+
<methods>
11+
<method name="fill_editor_colors">
12+
<return type="void" />
13+
<description>
14+
Editor-only method that copies colors setup in "Text Editor/Theme" editor settings to this CodeHighlighter.
15+
It is available in the Inspector as the "Fill with Editor colors" tool button.
16+
</description>
17+
</method>
18+
</methods>
19+
<members>
20+
<member name="comment_color" type="Color" setter="set_comment_color" getter="get_comment_color" default="Color(0, 0, 0, 1)">
21+
Color used for Lua comments.
22+
Setting this property will setup [member CodeHighlighter.color_regions] for Lua comments.
23+
</member>
24+
<member name="fill_editor_colors_callable" type="Callable" setter="" getter="get_fill_editor_colors" default="Callable()">
25+
Callable for [method fill_editor_colors], available in the Inspector as the "Fill with Editor colors" tool button.
26+
</member>
27+
<member name="lua_keyword_color" type="Color" setter="set_lua_keyword_color" getter="get_lua_keyword_color" default="Color(0, 0, 0, 1)">
28+
Color used for Lua keywords.
29+
Setting this property will setup [member CodeHighlighter.keyword_colors] for Lua keywords.
30+
</member>
31+
<member name="lua_member_keyword_color" type="Color" setter="set_lua_member_keyword_color" getter="get_lua_member_keyword_color" default="Color(0, 0, 0, 1)">
32+
Color used for Lua member keywords [code]self[/code], [code]_G[/code], [code]_ENV[/code] and [code]_VERSION[/code].
33+
Setting this property will setup [member CodeHighlighter.member_keyword_colors] for Lua member keywords.
34+
</member>
35+
<member name="string_color" type="Color" setter="set_string_color" getter="get_string_color" default="Color(0, 0, 0, 1)">
36+
Color used for Lua strings.
37+
Setting this property will setup [member CodeHighlighter.color_regions] for Lua strings.
38+
</member>
39+
</members>
40+
</class>

0 commit comments

Comments
 (0)