Commit 1271e094 authored by nanahira's avatar nanahira

rmpatch

parent 50f33353
diff --git a/lua/lbaselib.c b/lua/lbaselib.c
index b5c6236..b2e864a 100644
--- a/lua/lbaselib.c
+++ b/lua/lbaselib.c
@@ -124,11 +124,14 @@ static int luaB_getmetatable (lua_State *L) {
static int luaB_setmetatable (lua_State *L) {
int t = lua_type(L, 2);
- luaL_checktype(L, 1, LUA_TTABLE);
- luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,
- "nil or table expected");
- if (luaL_getmetafield(L, 1, "__metatable") != LUA_TNIL)
- return luaL_error(L, "cannot change a protected metatable");
+ int nocheck = lua_toboolean(L, 3);
+ if (!nocheck) {
+ luaL_checktype(L, 1, LUA_TTABLE);
+ luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,
+ "nil or table expected");
+ if (luaL_getmetafield(L, 1, "__metatable") != LUA_TNIL)
+ return luaL_error(L, "cannot change a protected metatable");
+ }
lua_settop(L, 2);
lua_setmetatable(L, 1);
return 1;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment