linit_flua.c (2a63c3be158216222d89a073dcbd6a72ee4aab5a) linit_flua.c (1f31e00e19f9e24d4c891a24973e08a027c4f71c)
1/*
2** $Id: linit.c,v 1.39.1.1 2017/04/19 17:20:42 roberto Exp $
3** Initialization of libraries for lua.c and other clients
4** See Copyright Notice in lua.h
5*/
6
7
8#define linit_c

--- 21 unchanged lines hidden (view full) ---

30#include <stddef.h>
31
32#include "lua.h"
33
34#include "lualib.h"
35#include "lauxlib.h"
36#include "lfs.h"
37#include "lposix.h"
1/*
2** $Id: linit.c,v 1.39.1.1 2017/04/19 17:20:42 roberto Exp $
3** Initialization of libraries for lua.c and other clients
4** See Copyright Notice in lua.h
5*/
6
7
8#define linit_c

--- 21 unchanged lines hidden (view full) ---

30#include <stddef.h>
31
32#include "lua.h"
33
34#include "lualib.h"
35#include "lauxlib.h"
36#include "lfs.h"
37#include "lposix.h"
38#include "lfbsd.h"
38#include "lua_ucl.h"
39
40/*
41** these libs are loaded by lua.c and are readily available to any Lua
42** program
43*/
44static const luaL_Reg loadedlibs[] = {
45 {"_G", luaopen_base},

--- 9 unchanged lines hidden (view full) ---

55#if defined(LUA_COMPAT_BITLIB)
56 {LUA_BITLIBNAME, luaopen_bit32},
57#endif
58 /* FreeBSD Extensions */
59 {"lfs", luaopen_lfs},
60 {"posix.sys.stat", luaopen_posix_sys_stat},
61 {"posix.unistd", luaopen_posix_unistd},
62 {"ucl", luaopen_ucl},
39#include "lua_ucl.h"
40
41/*
42** these libs are loaded by lua.c and are readily available to any Lua
43** program
44*/
45static const luaL_Reg loadedlibs[] = {
46 {"_G", luaopen_base},

--- 9 unchanged lines hidden (view full) ---

56#if defined(LUA_COMPAT_BITLIB)
57 {LUA_BITLIBNAME, luaopen_bit32},
58#endif
59 /* FreeBSD Extensions */
60 {"lfs", luaopen_lfs},
61 {"posix.sys.stat", luaopen_posix_sys_stat},
62 {"posix.unistd", luaopen_posix_unistd},
63 {"ucl", luaopen_ucl},
64 {"fbsd", luaopen_fbsd},
63 {NULL, NULL}
64};
65
66
67LUALIB_API void luaL_openlibs (lua_State *L) {
68 const luaL_Reg *lib;
69 /* "require" functions from 'loadedlibs' and set results to global table */
70 for (lib = loadedlibs; lib->func; lib++) {
71 luaL_requiref(L, lib->name, lib->func, 1);
72 lua_pop(L, 1); /* remove lib */
73 }
74}
75
65 {NULL, NULL}
66};
67
68
69LUALIB_API void luaL_openlibs (lua_State *L) {
70 const luaL_Reg *lib;
71 /* "require" functions from 'loadedlibs' and set results to global table */
72 for (lib = loadedlibs; lib->func; lib++) {
73 luaL_requiref(L, lib->name, lib->func, 1);
74 lua_pop(L, 1); /* remove lib */
75 }
76}
77