Maybe you were looking for the Enterprise Edition (EE) Documentation instead?

Table of Contents

kong.table

Utilities for Lua tables

kong.table.new([narr[, nrec]])

Returns a table with pre-allocated number of slots in its array and hash parts.

Parameters

  • narr (number, optional): specifies the number of slots to pre-allocate in the array part.
  • nrec (number, optional): specifies the number of slots to pre-allocate in the hash part.

Returns

  • table the newly created table

Usage

local tab = kong.table.new(4, 4)

Back to TOC

kong.table.clear(tab)

Clears a table from all of its array and hash parts entries.

Parameters

  • tab (table): the table which will be cleared

Returns

  • Nothing

Usage

local tab = {
  "hello",
  foo = "bar"
}

kong.table.clear(tab)

kong.log(tab[1]) -- nil
kong.log(tab.foo) -- nil

Back to TOC