e18b21c32d
each package to have an initialization file, and keeping a table of '<package> = <file>' entries in a known place. these files are loaded upon lua's activation, and should normally be small, quick pieces of code responsible for preparing the environment (luapath, cpath) for the packages they represent. also, make it possible for every user to have her/his own lua initialization routines under ~/.lua/init.lua, so that the system-wide mechanism described above can be replicated to user-specific cases. prodding, all sorts of ports tutoring and ok jolan@
21 lines
650 B
Plaintext
21 lines
650 B
Plaintext
$OpenBSD: patch-src_lua_lua_c,v 1.1 2004/12/16 13:04:07 pedro Exp $
|
|
--- src/lua/lua.c.orig Thu Apr 3 10:34:42 2003
|
|
+++ src/lua/lua.c Sun Sep 5 21:04:22 2004
|
|
@@ -385,9 +385,16 @@ static void openstdlibs (lua_State *l) {
|
|
}
|
|
}
|
|
|
|
+#ifndef LUA_SYSCONF
|
|
+#define LUA_SYSCONF "@initconf@"
|
|
+#endif
|
|
|
|
static int handle_luainit (void) {
|
|
const char *init = getenv("LUA_INIT");
|
|
+ /* load system-wide configuration file */
|
|
+ if (file_input(LUA_SYSCONF))
|
|
+ l_message(progname, "warning: couldn't load system-wide "
|
|
+ "configuration file");
|
|
if (init == NULL) return 0; /* status OK */
|
|
else if (init[0] == '@')
|
|
return file_input(init+1);
|