1/* $NetBSD$ */ 2 3/* 4** Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp 5** Initialization of libraries for lua.c 6** See Copyright Notice in lua.h 7*/ 8 9 10#define linit_c 11#define LUA_LIB 12 13#include "lua.h" 14 15#include "lualib.h" 16#include "lauxlib.h" 17 18 19static const luaL_Reg lualibs[] = { 20 {"", luaopen_base}, 21 {LUA_LOADLIBNAME, luaopen_package}, 22 {LUA_TABLIBNAME, luaopen_table}, 23 {LUA_IOLIBNAME, luaopen_io}, 24 {LUA_OSLIBNAME, luaopen_os}, 25 {LUA_STRLIBNAME, luaopen_string}, 26 {LUA_MATHLIBNAME, luaopen_math}, 27 {LUA_DBLIBNAME, luaopen_debug}, 28 {NULL, NULL} 29}; 30 31 32LUALIB_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 41