From 46de77b219e381ff8553fdba0f52b319c00ea1e1 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 3 Nov 2015 13:47:30 -0200 Subject: bug: despite its name, 'luaH_getstr' did not work for strings in general, but only for short strings --- ltable.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ltable.h') diff --git a/ltable.h b/ltable.h index 20ddacd0..bad66516 100644 --- a/ltable.h +++ b/ltable.h @@ -1,5 +1,5 @@ /* -** $Id: ltable.h,v 2.19 2014/07/29 16:22:24 roberto Exp roberto $ +** $Id: ltable.h,v 2.20 2014/09/04 18:15:29 roberto Exp roberto $ ** Lua tables (hash) ** See Copyright Notice in lua.h */ @@ -18,6 +18,10 @@ /* 'const' to avoid wrong writings that can mess up field 'next' */ #define gkey(n) cast(const TValue*, (&(n)->i_key.tvk)) +/* +** writable version of 'gkey'; allows updates to individual fields, +** but not to the whole (which has incompatible type) +*/ #define wgkey(n) (&(n)->i_key.nk) #define invalidateTMcache(t) ((t)->flags = 0) @@ -31,6 +35,7 @@ LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key); LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key, TValue *value); +LUAI_FUNC const TValue *luaH_getshortstr (Table *t, TString *key); LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); LUAI_FUNC TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key); -- cgit v1.2.3-55-g6feb