Skip to content

Commit

Permalink
fix: luatype indices are wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
mworzala committed Jul 7, 2024
1 parent d5000ed commit 32229ee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/main/java/net/hollowcube/luau/LuaStateImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -856,10 +856,8 @@ public boolean newMetaTable(@NotNull String typeName) {

@Override
public void getMetaTable(@NotNull String typeName) {
try (Arena arena = Arena.ofConfined()) {
final LuaType type = getField(LUA_REGISTRYINDEX(), typeName);
assert type == LuaType.TABLE : "expected table";
}
final LuaType type = getField(LUA_REGISTRYINDEX(), typeName);
assert type == LuaType.TABLE : "expected table";
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/hollowcube/luau/LuaType.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public enum LuaType {
private static final LuaType[] VALUES = values();

public static @NotNull LuaType byId(int id) {
return id >= 0 && id < VALUES.length ? VALUES[id] : NONE;
return id >= 0 && id < VALUES.length ? VALUES[id + 1] : NONE;
}

public int id() {
Expand Down

0 comments on commit 32229ee

Please sign in to comment.