From d4810424806393cd27a5fa6f0362a8f2a9069d73 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sun, 4 Feb 2024 11:28:22 +0100 Subject: [PATCH] bug fix - https://github.com/lua/lua/commit/c23f7053495934bc7fbce7328af1e7f03f248de1 --- client/deps/liblua/llex.c | 2 ++ client/deps/liblua/ltable.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/client/deps/liblua/llex.c b/client/deps/liblua/llex.c index bde26fa4f..8d6c012d3 100644 --- a/client/deps/liblua/llex.c +++ b/client/deps/liblua/llex.c @@ -131,6 +131,8 @@ TString *luaX_newstring(LexState *ls, const char *str, size_t l) { table has no metatable, so it does not need to invalidate cache */ setbvalue(o, 1); /* t[string] = true */ luaC_checkGC(L); + } else { /* string already present */ + ts = rawtsvalue(keyfromval(o)); /* re-use value previously stored */ } L->top--; /* remove string from stack */ return ts; diff --git a/client/deps/liblua/ltable.h b/client/deps/liblua/ltable.h index 7c3663abf..778cd8397 100644 --- a/client/deps/liblua/ltable.h +++ b/client/deps/liblua/ltable.h @@ -17,6 +17,10 @@ #define invalidateTMcache(t) ((t)->flags = 0) +/* returns the key, given the value of a table entry */ +#define keyfromval(v) \ + (gkey(cast(Node *, cast(char *, (v)) - offsetof(Node, i_val)))) + LUAI_FUNC const TValue *luaH_getint(Table *t, int key); LUAI_FUNC void luaH_setint(lua_State *L, Table *t, int key, TValue *value);