| 1088 | |
| 1089 | |
| 1090 | LUA_API void lua_setreadonly (lua_State *L, int idx, int state) { /*BZ*/ |
| 1091 | const lu_byte mask = (LUA_READONLY_OLD_LUA_BIT | LUA_READONLY_OLD_CAPI_BIT | |
| 1092 | LUA_READONLY_NEW_LUA_BIT | LUA_READONLY_NEW_CAPI_BIT); |
| 1093 | StkId o; |
| 1094 | Table* t; |
| 1095 | lua_lock(L); |
| 1096 | api_checknelems(L, 1); |
| 1097 | o = index2adr(L, idx); |
| 1098 | api_check(L, ttistable(o)); |
| 1099 | t = hvalue(o); |
| 1100 | t->readonly = (t->readonly & ~mask) | (cast(lu_byte, state) & mask); |
| 1101 | lua_unlock(L); |
| 1102 | } |
| 1103 | |
| 1104 | #endif |
| 1105 |