Skip to content

Commit 00eebdc

Browse files
committed
fix: return values from lua_yield and lua_break
they return a value which can be returned from a lua call (its -1, indicating a status change i guess)
1 parent e56b36f commit 00eebdc

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/main/java/net/hollowcube/luau/LuaState.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ Set Functions (Stack -> Lua)
199199
Coroutine Functions
200200
*/
201201

202-
void yield(int resultCount);
203-
void break_();
202+
int yield(int resultCount);
203+
int break_();
204204
@NotNull LuaStatus resume(@NotNull LuaState from, int argCount);
205205
@NotNull LuaStatus resumeError(@NotNull LuaState from);
206206
@NotNull LuaStatus status();

src/main/java/net/hollowcube/luau/LuaStateImpl.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -665,15 +665,13 @@ public void pcall(int argCount, int resultCount) {
665665
}
666666

667667
@Override
668-
public void yield(int resultCount) {
669-
// lua_yield does return an int, but its always -1.
670-
lua_yield(L, resultCount);
668+
public int yield(int resultCount) {
669+
return lua_yield(L, resultCount);
671670
}
672671

673672
@Override
674-
public void break_() {
675-
// lua_break does return an int, but its always -1.
676-
lua_break(L);
673+
public int break_() {
674+
return lua_break(L);
677675
}
678676

679677
@Override

0 commit comments

Comments
 (0)