1999-01-08 19:49:32 +03:00
|
|
|
/*
|
2005-12-29 19:23:32 +03:00
|
|
|
** $Id: linit.c,v 1.13 2005/08/26 17:36:32 roberto Exp roberto $
|
1999-01-08 19:49:32 +03:00
|
|
|
** Initialization of libraries for lua.c
|
|
|
|
** See Copyright Notice in lua.h
|
|
|
|
*/
|
|
|
|
|
2004-07-09 18:29:29 +04:00
|
|
|
|
|
|
|
#define linit_c
|
|
|
|
#define LUA_LIB
|
|
|
|
|
|
|
|
#include "lua.h"
|
|
|
|
|
|
|
|
#include "lualib.h"
|
|
|
|
#include "lauxlib.h"
|
|
|
|
|
|
|
|
|
2005-08-26 21:36:32 +04:00
|
|
|
static const luaL_Reg lualibs[] = {
|
2004-07-09 18:29:29 +04:00
|
|
|
{"", luaopen_base},
|
2005-12-29 19:23:32 +03:00
|
|
|
{LUA_LOADLIBNAME, luaopen_package},
|
2004-07-09 18:29:29 +04:00
|
|
|
{LUA_TABLIBNAME, luaopen_table},
|
|
|
|
{LUA_IOLIBNAME, luaopen_io},
|
2004-07-09 19:47:48 +04:00
|
|
|
{LUA_OSLIBNAME, luaopen_os},
|
2004-07-09 18:29:29 +04:00
|
|
|
{LUA_STRLIBNAME, luaopen_string},
|
|
|
|
{LUA_MATHLIBNAME, luaopen_math},
|
|
|
|
{LUA_DBLIBNAME, luaopen_debug},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-04-13 21:24:20 +04:00
|
|
|
LUALIB_API void luaL_openlibs (lua_State *L) {
|
2005-08-26 21:36:32 +04:00
|
|
|
const luaL_Reg *lib = lualibs;
|
2004-07-09 18:29:29 +04:00
|
|
|
for (; lib->func; lib++) {
|
2005-04-13 21:24:20 +04:00
|
|
|
lua_pushcfunction(L, lib->func);
|
|
|
|
lua_pushstring(L, lib->name);
|
|
|
|
lua_call(L, 1, 0);
|
2004-07-09 18:29:29 +04:00
|
|
|
}
|
|
|
|
}
|
1999-01-08 19:49:32 +03:00
|
|
|
|