1
0
mirror of https://github.com/lua/lua.git synced 2025-01-28 06:03:00 +08:00
lua/linit.c

39 lines
769 B
C
Raw Normal View History

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