From 9f851dc28594ee9a5ef929e32b520bcbfa8a486f Mon Sep 17 00:00:00 2001
From: Louis-Antoine <lamr@free.fr>
Date: Mon, 9 Nov 2020 00:16:40 +0100
Subject: [PATCH] Return explicitly when failing to register a metatable

---
 src/lua_baselib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lua_baselib.c b/src/lua_baselib.c
index ac9b6053d7..3acbd3d0f9 100644
--- a/src/lua_baselib.c
+++ b/src/lua_baselib.c
@@ -257,7 +257,7 @@ static int lib_registerMetatable(lua_State *L)
 	luaL_checktype(L, 1, LUA_TTABLE);
 
 	if (nextid == 0)
-		luaL_error(L, "Too many metatables registered?! Please consider rewriting your script once you are sober again.\n");
+		return luaL_error(L, "Too many metatables registered?! Please consider rewriting your script once you are sober again.\n");
 
 	lua_getfield(L, LUA_REGISTRYINDEX, LREG_METATABLES); // 2
 		// registry.metatables[metatable] = nextid
-- 
GitLab