| 123 | |
| 124 | |
| 125 | static int luaB_setmetatable (lua_State *L) { |
| 126 | int t = lua_type(L, 2); |
| 127 | luaL_checktype(L, 1, LUA_TTABLE); |
| 128 | luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, |
| 129 | "nil or table expected"); |
| 130 | if (luaL_getmetafield(L, 1, "__metatable") != LUA_TNIL) |
| 131 | return luaL_error(L, "cannot change a protected metatable"); |
| 132 | lua_settop(L, 2); |
| 133 | lua_setmetatable(L, 1); |
| 134 | return 1; |
| 135 | } |
| 136 | |
| 137 | |
| 138 | static int luaB_rawequal (lua_State *L) { |
nothing calls this directly
no test coverage detected