summaryrefslogtreecommitdiff
path: root/deps/lua/src/lvm.c
diff options
context:
space:
mode:
authormeir <meir@redis.com>2022-02-06 13:43:18 +0200
committermeir <meir@redis.com>2022-04-27 00:20:54 +0300
commit8b33d813a3d47d4daeaaef03b7e42a51f6931f79 (patch)
tree80c6a7ec11499b55b698d8e63cd15bb6f4c33fcb /deps/lua/src/lvm.c
parent81926254586f64fc6a9b393bf9afb0d2eacc5234 (diff)
downloadredis-8b33d813a3d47d4daeaaef03b7e42a51f6931f79.tar.gz
Added support for Lua readonly tables.
The new feature can be turned off and on using the new `lua_enablereadonlytable` Lua API.
Diffstat (limited to 'deps/lua/src/lvm.c')
-rw-r--r--deps/lua/src/lvm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/deps/lua/src/lvm.c b/deps/lua/src/lvm.c
index e0a0cd852..5cd313b5e 100644
--- a/deps/lua/src/lvm.c
+++ b/deps/lua/src/lvm.c
@@ -138,6 +138,8 @@ void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
const TValue *tm;
if (ttistable(t)) { /* `t' is a table? */
Table *h = hvalue(t);
+ if (h->readonly)
+ luaG_runerror(L, "Attempt to modify a readonly table");
TValue *oldval = luaH_set(L, h, key); /* do a primitive set */
if (!ttisnil(oldval) || /* result is no nil? */
(tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */