# ltable.c File Reference

`#include <math.h>`
`#include <string.h>`
`#include "lua.h"`
`#include "ldebug.h"`
`#include "ldo.h"`
`#include "lgc.h"`
`#include "lmem.h"`
`#include "lobject.h"`
`#include "lstate.h"`
`#include "ltable.h"`

## Defines
#define | ltable_c
#define | LUA_CORE
#define | MAXBITS (LUAI_BITSINT-2)
#define | MAXASIZE (1 << MAXBITS)
#define | hashpow2(t, n) (gnode(t, lmod((n), sizenode(t))))
#define | hashstr(t, str) hashpow2(t, (str)->tsv.hash)
#define | hashboolean(t, p) hashpow2(t, p)
#define | hashmod(t, n) (gnode(t, ((n) % ((sizenode(t)-1)|1))))
#define | hashpointer(t, p) hashmod(t, IntPoint(p))
#define | numints cast_int(sizeof(lua_Number)/sizeof(int))
#define | dummynode (&dummynode_)
## Functions
static Node * | hashnum (const Table *t, lua_Number n)
static Node * | mainposition (const Table *t, const TValue *key)
static int | arrayindex (const TValue *key)
static int | findindex (lua_State *L, Table *t, StkId key)
int | luaH_next (lua_State *L, Table *t, StkId key)
static int | computesizes (int nums[], int *narray)
static int | countint (const TValue *key, int *nums)
static int | numusearray (const Table *t, int *nums)
static int | numusehash (const Table *t, int *nums, int *pnasize)
static void | setarrayvector (lua_State *L, Table *t, int size)
static void | setnodevector (lua_State *L, Table *t, int size)
static void | resize (lua_State *L, Table *t, int nasize, int nhsize)
void | luaH_resizearray (lua_State *L, Table *t, int nasize)
static void | rehash (lua_State *L, Table *t, const TValue *ek)
Table * | luaH_new (lua_State *L, int narray, int nhash)
void | luaH_free (lua_State *L, Table *t)
static Node * | getfreepos (Table *t)
static TValue * | newkey (lua_State *L, Table *t, const TValue *key)
const TValue * | luaH_getnum (Table *t, int key)
const TValue * | luaH_getstr (Table *t, TString *key)
const TValue * | luaH_get (Table *t, const TValue *key)
TValue * | luaH_set (lua_State *L, Table *t, const TValue *key)
TValue * | luaH_setnum (lua_State *L, Table *t, int key)
TValue * | luaH_setstr (lua_State *L, Table *t, TString *key)
static int | unbound_search (Table *t, unsigned int j)
int | luaH_getn (Table *t)
## Variables
static const Node | dummynode_

## Define Documentation

#define dummynode (&dummynode_)

#define hashboolean | ( | t,
|  | p |  | ) | hashpow2(t, p)

#define hashmod | ( | t,
|  | n |  | ) | (gnode(t, ((n) % ((sizenode(t)-1)|1))))

#define hashpointer | ( | t,
|  | p |  | ) | hashmod(t, IntPoint(p))

#define hashpow2 | ( | t,
|  | n |  | ) | (gnode(t, lmod((n), sizenode(t))))

#define hashstr | ( | t,
|  | str |  | ) | hashpow2(t, (str)->tsv.hash)

#define ltable_c

#define LUA_CORE

#define MAXASIZE (1 << MAXBITS)

#define MAXBITS (LUAI_BITSINT-2)

#define numints cast_int(sizeof(lua_Number)/sizeof(int))

## Function Documentation

static int arrayindex | ( | const TValue * | key | ) | `[static]`

static int computesizes | ( | int | nums[],
|  | int * | narray |
| ) |  |  | `[static]`

static int countint | ( | const TValue * | key,
|  | int * | nums |
| ) |  |  | `[static]`

static int findindex | ( | lua_State * | L,
|  | Table * | t,
|  | StkId | key |
| ) |  |  | `[static]`

static Node* getfreepos | ( | Table * | t | ) | `[static]`

static Node* hashnum | ( | const Table * | t,
|  | lua_Number | n |
| ) |  |  | `[static]`

void luaH_free | ( | lua_State * | L,
|  | Table * | t |
| ) |  |  |

const TValue* luaH_get | ( | Table * | t,
|  | const TValue * | key |
| ) |  |  |

int luaH_getn | ( | Table * | t | ) |

const TValue* luaH_getnum | ( | Table * | t,
|  | int | key |
| ) |  |  |

const TValue* luaH_getstr | ( | Table * | t,
|  | TString * | key |
| ) |  |  |

Table* luaH_new | ( | lua_State * | L,
|  | int | narray,
|  | int | nhash |
| ) |  |  |

int luaH_next | ( | lua_State * | L,
|  | Table * | t,
|  | StkId | key |
| ) |  |  |

void luaH_resizearray | ( | lua_State * | L,
|  | Table * | t,
|  | int | nasize |
| ) |  |  |

TValue* luaH_set | ( | lua_State * | L,
|  | Table * | t,
|  | const TValue * | key |
| ) |  |  |

TValue* luaH_setnum | ( | lua_State * | L,
|  | Table * | t,
|  | int | key |
| ) |  |  |

TValue* luaH_setstr | ( | lua_State * | L,
|  | Table * | t,
|  | TString * | key |
| ) |  |  |

static Node* mainposition | ( | const Table * | t,
|  | const TValue * | key |
| ) |  |  | `[static]`

static TValue* newkey | ( | lua_State * | L,
|  | Table * | t,
|  | const TValue * | key |
| ) |  |  | `[static]`

static int numusearray | ( | const Table * | t,
|  | int * | nums |
| ) |  |  | `[static]`

static int numusehash | ( | const Table * | t,
|  | int * | nums,
|  | int * | pnasize |
| ) |  |  | `[static]`

static void rehash | ( | lua_State * | L,
|  | Table * | t,
|  | const TValue * | ek |
| ) |  |  | `[static]`

static void resize | ( | lua_State * | L,
|  | Table * | t,
|  | int | nasize,
|  | int | nhsize |
| ) |  |  | `[static]`

static void setarrayvector | ( | lua_State * | L,
|  | Table * | t,
|  | int | size |
| ) |  |  | `[static]`

static void setnodevector | ( | lua_State * | L,
|  | Table * | t,
|  | int | size |
| ) |  |  | `[static]`

static int unbound_search | ( | Table * | t,
|  | unsigned int | j |
| ) |  |  | `[static]`

## Variable Documentation

const Node dummynode_`[static]`

Initial value:

     {
      {{NULL}, LUA_TNIL},
      {{{NULL}, LUA_TNIL, NULL}}
    }