ltablib.cpp File Reference

#include <stddef.h>
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"

Go to the source code of this file.

Defines

#define ltablib_c
#define LUA_LIB
#define aux_getn(L, n)   (luaL_checktype(L, n, LUA_TTABLE), luaL_getn(L, n))

Functions

static int foreachi (lua_State *L)
static int foreach (lua_State *L)
static int maxn (lua_State *L)
static int getn (lua_State *L)
static int setn (lua_State *L)
static int tinsert (lua_State *L)
static int tremove (lua_State *L)
static int tconcat (lua_State *L)
static void set2 (lua_State *L, int i, int j)
static int sort_comp (lua_State *L, int a, int b)
static void auxsort (lua_State *L, int l, int u)
static int sort (lua_State *L)
LUALIB_API int luaopen_table (lua_State *L)

Variables

static const luaL_Reg tab_funcs []


Define Documentation

#define aux_getn ( L,
n   )     (luaL_checktype(L, n, LUA_TTABLE), luaL_getn(L, n))

Definition at line 19 of file ltablib.cpp.

Referenced by foreachi(), getn(), sort(), tinsert(), and tremove().

#define ltablib_c

Definition at line 10 of file ltablib.cpp.

#define LUA_LIB

Definition at line 11 of file ltablib.cpp.


Function Documentation

static void auxsort ( lua_State L,
int  l,
int  u 
) [static]

Definition at line 184 of file ltablib.cpp.

References lua_pop, lua_pushvalue(), lua_rawgeti(), luaL_error(), set2(), and sort_comp().

Referenced by sort().

static int foreach ( lua_State L  )  [static]

Definition at line 39 of file ltablib.cpp.

References lua_call(), lua_isnil, lua_next(), lua_pop, lua_pushnil(), lua_pushvalue(), LUA_TFUNCTION, LUA_TTABLE, and luaL_checktype().

static int foreachi ( lua_State L  )  [static]

Definition at line 22 of file ltablib.cpp.

References aux_getn, lua_call(), lua_isnil, lua_pop, lua_pushinteger(), lua_pushvalue(), lua_rawgeti(), LUA_TFUNCTION, and luaL_checktype().

static int getn ( lua_State L  )  [static]

Definition at line 72 of file ltablib.cpp.

References aux_getn, and lua_pushinteger().

LUALIB_API int luaopen_table ( lua_State L  ) 

Definition at line 274 of file ltablib.cpp.

Referenced by LUAScript::LUAScript().

static int maxn ( lua_State L  )  [static]

Definition at line 56 of file ltablib.cpp.

References lua_next(), lua_pop, lua_pushnil(), lua_pushnumber(), LUA_TNUMBER, lua_tonumber(), LUA_TTABLE, lua_type(), and luaL_checktype().

static void set2 ( lua_State L,
int  i,
int  j 
) [static]

Definition at line 164 of file ltablib.cpp.

References lua_rawseti().

Referenced by auxsort().

static int setn ( lua_State L  )  [static]

Definition at line 78 of file ltablib.cpp.

References lua_pushvalue(), LUA_QL, LUA_TTABLE, luaL_checkint, luaL_checktype(), luaL_error(), and luaL_setn.

static int sort ( lua_State L  )  [static]

Definition at line 247 of file ltablib.cpp.

References aux_getn, auxsort(), lua_isnoneornil, lua_settop(), LUA_TFUNCTION, luaL_checkstack(), and luaL_checktype().

Referenced by ServerNewGameState::checkTeamsAuto(), ParticleEngine::normalizedSimulate(), ServerWebHandler::LogFileHandler::processRequest(), ServerBrowserServerList::sortEntries(), and Sound::updateSources().

static int sort_comp ( lua_State L,
int  a,
int  b 
) [static]

Definition at line 169 of file ltablib.cpp.

References lua_call(), lua_isnil, lua_lessthan(), lua_pop, lua_pushvalue(), and lua_toboolean().

Referenced by auxsort().

static int tconcat ( lua_State L  )  [static]

Definition at line 134 of file ltablib.cpp.

References lua_isstring(), lua_rawgeti(), LUA_TTABLE, luaL_addlstring(), luaL_addvalue(), luaL_argcheck, luaL_buffinit(), luaL_checkint, luaL_checktype(), luaL_getn, luaL_opt, luaL_optint, luaL_optlstring(), and luaL_pushresult().

static int tinsert ( lua_State L  )  [static]

Definition at line 90 of file ltablib.cpp.

References aux_getn, lua_gettop(), LUA_QL, lua_rawgeti(), lua_rawseti(), luaL_checkint, luaL_error(), and luaL_setn.

static int tremove ( lua_State L  )  [static]

Definition at line 118 of file ltablib.cpp.

References aux_getn, lua_pushnil(), lua_rawgeti(), lua_rawseti(), luaL_optint, and luaL_setn.


Variable Documentation

const luaL_Reg tab_funcs[] [static]

Initial value:

 {
  {"concat", tconcat},
  {"foreach", foreach},
  {"foreachi", foreachi},
  {"getn", getn},
  {"maxn", maxn},
  {"insert", tinsert},
  {"remove", tremove},
  {"setn", setn},
  {"sort", sort},
  {NULL, NULL}
}

Definition at line 260 of file ltablib.cpp.


Generated on Mon Feb 16 15:14:58 2009 for Scorched3D by  doxygen 1.5.3