| 10966 | |
| 10967 | |
| 10968 | static int luaB_setmetatable (lua_State *L) { |
| 10969 | int t = lua_type(L, 2); |
| 10970 | luaL_checktype(L, 1, LUA_TTABLE); |
| 10971 | luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, |
| 10972 | "nil or table expected"); |
| 10973 | if (luaL_getmetafield(L, 1, "__metatable")) |
| 10974 | luaL_error(L, "cannot change a protected metatable"); |
| 10975 | lua_settop(L, 2); |
| 10976 | lua_setmetatable(L, 1); |
| 10977 | return 1; |
| 10978 | } |
| 10979 | |
| 10980 | |
| 10981 | static void getfunc (lua_State *L, int opt) { |
nothing calls this directly
no test coverage detected