Skip to content
This repository was archived by the owner on Dec 29, 2024. It is now read-only.

Commit b1be588

Browse files
authored
Fix lua_hook pushing a nil value if hook returns nothing (#120)
1 parent 7227e01 commit b1be588

4 files changed

Lines changed: 9 additions & 10 deletions

File tree

.github/workflows/gdextension-unit-tests.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v3
1515
- name: Download godot 4.0.3
16-
uses: wei/wget@v1
17-
with:
18-
args: -O godot.zip https://downloads.tuxfamily.org/godotengine/4.0.3/Godot_v4.0.3-stable_linux.x86_64.zip
16+
run: wget -O godot.zip https://downloads.tuxfamily.org/godotengine/4.0.3/Godot_v4.0.3-stable_linux.x86_64.zip
1917
- name: Extract godot
2018
run: |
2119
7z x godot.zip
@@ -45,9 +43,7 @@ jobs:
4543
steps:
4644
- uses: actions/checkout@v3
4745
- name: Download godot 4.0.3
48-
uses: wei/wget@v1
49-
with:
50-
args: -O godot.zip https://downloads.tuxfamily.org/godotengine/4.0.3/Godot_v4.0.3-stable_linux.x86_64.zip
46+
run: wget -O godot.zip https://downloads.tuxfamily.org/godotengine/4.0.3/Godot_v4.0.3-stable_linux.x86_64.zip
5147
- name: Extract godot
5248
run: |
5349
7z x godot.zip

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ About
1414
![Logo](.github/LuaAPI.png)
1515
Art created by [Alex](https://www.instagram.com/redheadalex1)
1616

17-
***WARNING!!!*** this is a **beta** version of the addon made for Godot v4.0-stable. Which means frequent recompiles may be required and compatibility is not guaranteed between updates. Please see the branch [v1.1-stable](https://github.com/WeaselGames/godot_luaAPI/tree/v1.1-stable) for godot v3.x.
17+
***WARNING!!!*** this is a **beta** version of the addon made for Godot v4.0-stable. Which means frequent recompiles may be required and compatibility is not guaranteed between updates.
1818

19-
This is a Godot addon that adds Lua API support via GDScript. Importantly this is **NOT** meant to be a replacement for or alternative to GDScript. This addon provides no functionality to program your game out of the box. This addon allows you to create custom Modding API's in a sandboxed environment. You have control of what people can and can not do within that sandbox.
19+
This is a Godot addon that adds Lua API support via GDScript, C# or GDExtension. Importantly this is **NOT** meant to be a replacement for or alternative to GDScript. This addon provides no functionality to program your game out of the box. This addon allows you to create custom Modding API's in a sandboxed environment. You have control of what people can and can not do within that sandbox.
2020

2121
To use you can either [Compile from source](#compiling) or you can download one of the [nightly builds](#nightly-builds).
2222

scripts/codespell.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ SKIP_LIST="./external,./.git,*.desktop,*.gen.*,*.po,*.pot,*.rc"
33

44
IGNORE_LIST="curvelinear,doubleclick,expct,findn,gird,hel,inout,lod,nd,numer,ot,te,vai"
55

6-
codespell -w -q 3 -S "${SKIP_LIST}" -L "${IGNORE_LIST}" --builtin "clear,rare,en-GB_to_en-US"git status
6+
codespell -w -q 3 -S "${SKIP_LIST}" -L "${IGNORE_LIST}" --builtin "clear,rare,en-GB_to_en-US"

src/luaState.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,6 @@ void LuaCoroutine::luaHook(lua_State *state, lua_Debug *ar) {
896896
const int argc = 3;
897897
const Variant *p_args[argc];
898898
for (int i = 0; i < argc; i++) {
899-
args[i] = LuaState::getVariant(state, i + 1, OBJ);
900899
p_args[i] = &args[i];
901900
}
902901

@@ -910,6 +909,10 @@ void LuaCoroutine::luaHook(lua_State *state, lua_Debug *ar) {
910909
return;
911910
}
912911

912+
if (returned.get_type() == Variant::NIL) {
913+
return;
914+
}
915+
913916
LuaError *err = LuaState::pushVariant(state, returned);
914917
if (err != nullptr) {
915918
lua_pushstring(state, err->getMessage().ascii().get_data());

0 commit comments

Comments
 (0)