1997-09-16 12:25:59 -07:00
|
|
|
/*
|
2018-08-23 10:26:12 -07:00
|
|
|
** $Id: ltable.h $
|
1997-09-16 12:25:59 -07:00
|
|
|
** Lua tables (hash)
|
|
|
|
** See Copyright Notice in lua.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ltable_h
|
|
|
|
#define ltable_h
|
|
|
|
|
|
|
|
#include "lobject.h"
|
|
|
|
|
|
|
|
|
2003-03-18 04:50:04 -08:00
|
|
|
#define gnode(t,i) (&(t)->node[i])
|
|
|
|
#define gval(n) (&(n)->i_val)
|
2017-06-09 09:48:44 -07:00
|
|
|
#define gnext(n) ((n)->u.next)
|
2004-10-06 11:34:16 -07:00
|
|
|
|
2014-07-29 09:22:24 -07:00
|
|
|
|
2020-08-07 07:21:44 -07:00
|
|
|
/*
|
|
|
|
** Clear all bits of fast-access metamethods, which means that the table
|
|
|
|
** may have any of these metamethods. (First access that fails after the
|
|
|
|
** clearing will set the bit again.)
|
|
|
|
*/
|
|
|
|
#define invalidateTMcache(t) ((t)->flags &= ~maskflags)
|
2011-08-17 13:26:47 -07:00
|
|
|
|
2001-08-30 13:56:43 -07:00
|
|
|
|
2016-11-07 04:38:35 -08:00
|
|
|
/* true when 't' is using 'dummynode' as its hash part */
|
|
|
|
#define isdummy(t) ((t)->lastfree == NULL)
|
|
|
|
|
|
|
|
|
|
|
|
/* allocated size for hash nodes */
|
|
|
|
#define allocsizenode(t) (isdummy(t) ? 0 : sizenode(t))
|
|
|
|
|
|
|
|
|
2017-06-09 09:48:44 -07:00
|
|
|
/* returns the Node, given the value of a table entry */
|
2020-04-23 10:48:15 -07:00
|
|
|
#define nodefromval(v) cast(Node *, (v))
|
2013-08-30 09:01:37 -07:00
|
|
|
|
|
|
|
|
2013-04-26 08:39:25 -07:00
|
|
|
LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key);
|
|
|
|
LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key,
|
2014-09-04 11:15:29 -07:00
|
|
|
TValue *value);
|
2015-11-03 07:47:30 -08:00
|
|
|
LUAI_FUNC const TValue *luaH_getshortstr (Table *t, TString *key);
|
2005-04-25 12:24:10 -07:00
|
|
|
LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key);
|
|
|
|
LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key);
|
2020-12-04 06:08:42 -08:00
|
|
|
LUAI_FUNC void luaH_newkey (lua_State *L, Table *t, const TValue *key,
|
|
|
|
TValue *value);
|
|
|
|
LUAI_FUNC void luaH_set (lua_State *L, Table *t, const TValue *key,
|
|
|
|
TValue *value);
|
|
|
|
LUAI_FUNC void luaH_finishset (lua_State *L, Table *t, const TValue *key,
|
|
|
|
const TValue *slot, TValue *value);
|
2006-07-11 08:53:29 -07:00
|
|
|
LUAI_FUNC Table *luaH_new (lua_State *L);
|
2014-09-04 11:15:29 -07:00
|
|
|
LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize,
|
|
|
|
unsigned int nhsize);
|
|
|
|
LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize);
|
2005-04-25 12:24:10 -07:00
|
|
|
LUAI_FUNC void luaH_free (lua_State *L, Table *t);
|
|
|
|
LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key);
|
2017-05-19 05:48:15 -07:00
|
|
|
LUAI_FUNC lua_Unsigned luaH_getn (Table *t);
|
2018-06-15 07:14:20 -07:00
|
|
|
LUAI_FUNC unsigned int luaH_realasize (const Table *t);
|
1999-10-26 03:53:40 -07:00
|
|
|
|
2006-01-10 04:51:53 -08:00
|
|
|
|
2006-01-10 05:13:06 -08:00
|
|
|
#if defined(LUA_DEBUG)
|
|
|
|
LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key);
|
|
|
|
#endif
|
2006-01-10 04:51:53 -08:00
|
|
|
|
1997-09-16 12:25:59 -07:00
|
|
|
|
|
|
|
#endif
|