allow 3a as no group

This commit is contained in:
2025-12-26 21:36:16 +01:00
parent d14c580ce1
commit f0b44e607e
2 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -417,7 +417,6 @@ int lua_register_oda(lua_State *localL) {
break;
case 10:
case 4:
case 3:
case 1:
if(mod->enc->state[mod->enc->program].user_oda.odas[id].group_version == 0) return luaL_error(localL, "Invalid group");
default:
@@ -434,6 +433,7 @@ int lua_set_oda_handler(lua_State *localL) {
uint8_t idx = luaL_checkinteger(localL, 1);
if(idx >= 32) return luaL_error(localL, "There can't be more than 32 registered ODAs");
if(mod->enc->state[mod->enc->program].user_oda.odas[idx].group == 0) return luaL_error(localL, "this oda is not registered");
if(mod->enc->state[mod->enc->program].user_oda.odas[idx].group == 3) return luaL_error(localL, "this oda cannot have a handler");
luaL_checktype(localL, 2, LUA_TFUNCTION);
lua_pushvalue(localL, 2);
if(mod->enc->state[mod->enc->program].user_oda.odas[idx].lua_handler != 0) luaL_unref(localL, LUA_REGISTRYINDEX, mod->enc->state[mod->enc->program].user_oda.odas[idx].lua_handler);