root/lib/lua/linit.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. luaL_openlibs

   1 /*
   2 ** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $
   3 ** Initialization of libraries for lua.c
   4 ** See Copyright Notice in lua.h
   5 */
   6 
   7 
   8 #define linit_c
   9 #define LUA_LIB
  10 
  11 #include "lua.h"
  12 
  13 #include "lualib.h"
  14 #include "lauxlib.h"
  15 
  16 
  17 static const luaL_Reg lualibs[] = {
  18   {"", (void*)luaopen_base},
  19   {LUA_LOADLIBNAME, (void*)luaopen_package},
  20   {LUA_TABLIBNAME, (void*)luaopen_table},
  21   {LUA_IOLIBNAME, (void*)luaopen_io},
  22   {LUA_OSLIBNAME, (void*)luaopen_os},
  23   {LUA_STRLIBNAME, (void*)luaopen_string},
  24   {LUA_MATHLIBNAME, (void*)luaopen_math},
  25   {LUA_IMATHLIBNAME, (void*)luaopen_imath},
  26   {LUA_FMATHLIBNAME, (void*)luaopen_fmath},
  27   {LUA_DBLIBNAME, (void*)luaopen_debug},
  28   {NULL, NULL}
  29 };
  30 
  31 
  32 LUALIB_API void luaL_openlibs (lua_State *L) {
  33   const luaL_Reg *lib = lualibs;
  34   for (; lib->func; lib++) {
  35     lua_pushcfunction(L, lib->func);
  36     lua_pushstring(L, lib->name);
  37     lua_call(L, 1, 0);
  38   }
  39 }
  40 

/* [<][>][^][v][top][bottom][index][help] */