Index: sys/modules/lua/Makefile
===================================================================
RCS file: /cvsroot/src/sys/modules/lua/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- sys/modules/lua/Makefile	31 Oct 2013 16:50:14 -0000	1.2
+++ sys/modules/lua/Makefile	26 Nov 2013 01:39:49 -0000
@@ -10,7 +10,7 @@
 
 WARNS=		1
 
-# Lua source code
+# Lua core source code
 SRCS+=		lapi.c \
 		lcode.c \
 		ldebug.c \
@@ -29,11 +29,13 @@
 		ltm.c \
 		lundump.c \
 		lvm.c \
-		lzio.c \
-		# lauxlib.c \
-		ltablib.c \
-		lstrlib.c \
+		lzio.c
+
+# Lua std libs source code
+SRCS+=		lauxlib.c \
 		lbaselib.c \
+		lstrlib.c \
+		ltablib.c \
 		linit.c
 
 # Compatability code
Index: external/mit/lua/dist/src/lauxlib.c
===================================================================
RCS file: /cvsroot/src/external/mit/lua/dist/src/lauxlib.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 lauxlib.c
--- external/mit/lua/dist/src/lauxlib.c	15 Mar 2012 00:08:09 -0000	1.1.1.2
+++ external/mit/lua/dist/src/lauxlib.c	26 Nov 2013 01:39:49 -0000
@@ -521,6 +521,7 @@
 ** =======================================================
 */
 
+#ifndef _KERNEL
 typedef struct LoadF {
   int extraline;
   FILE *f;
@@ -590,6 +591,7 @@
   lua_remove(L, fnameindex);
   return status;
 }
+#endif
 
 
 typedef struct LoadS {
@@ -626,6 +628,7 @@
 /* }====================================================== */
 
 
+#ifndef _KERNEL
 static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
   (void)ud;
   (void)osize;
@@ -651,4 +654,5 @@
   if (L) lua_atpanic(L, &panic);
   return L;
 }
+#endif
 
Index: external/mit/lua/dist/src/lbaselib.c
===================================================================
RCS file: /cvsroot/src/external/mit/lua/dist/src/lbaselib.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 lbaselib.c
--- external/mit/lua/dist/src/lbaselib.c	15 Mar 2012 00:08:06 -0000	1.1.1.2
+++ external/mit/lua/dist/src/lbaselib.c	26 Nov 2013 01:39:49 -0000
@@ -284,10 +284,12 @@
 }
 
 
+#ifndef _KERNEL
 static int luaB_loadfile (lua_State *L) {
   const char *fname = luaL_optstring(L, 1, NULL);
   return load_aux(L, luaL_loadfile(L, fname));
 }
+#endif
 
 
 /*
@@ -324,6 +326,7 @@
 }
 
 
+#ifndef _KERNEL
 static int luaB_dofile (lua_State *L) {
   const char *fname = luaL_optstring(L, 1, NULL);
   int n = lua_gettop(L);
@@ -331,6 +334,7 @@
   lua_call(L, 0, LUA_MULTRET);
   return lua_gettop(L) - n;
 }
+#endif
 
 
 static int luaB_assert (lua_State *L) {
@@ -449,12 +453,16 @@
 static const luaL_Reg base_funcs[] = {
   {"assert", luaB_assert},
   {"collectgarbage", luaB_collectgarbage},
+#ifndef _KERNEL
   {"dofile", luaB_dofile},
+#endif
   {"error", luaB_error},
   {"gcinfo", luaB_gcinfo},
   {"getfenv", luaB_getfenv},
   {"getmetatable", luaB_getmetatable},
+#ifndef _KERNEL
   {"loadfile", luaB_loadfile},
+#endif
   {"load", luaB_load},
   {"loadstring", luaB_loadstring},
   {"next", luaB_next},
Index: external/mit/lua/dist/src/linit.c
===================================================================
RCS file: /cvsroot/src/external/mit/lua/dist/src/linit.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 linit.c
--- external/mit/lua/dist/src/linit.c	15 Mar 2012 00:08:04 -0000	1.1.1.2
+++ external/mit/lua/dist/src/linit.c	26 Nov 2013 01:39:49 -0000
@@ -18,13 +18,19 @@
 
 static const luaL_Reg lualibs[] = {
   {"", luaopen_base},
+#ifndef _KERNEL
   {LUA_LOADLIBNAME, luaopen_package},
+#endif
   {LUA_TABLIBNAME, luaopen_table},
+#ifndef _KERNEL
   {LUA_IOLIBNAME, luaopen_io},
   {LUA_OSLIBNAME, luaopen_os},
+#endif
   {LUA_STRLIBNAME, luaopen_string},
+#ifndef _KERNEL
   {LUA_MATHLIBNAME, luaopen_math},
   {LUA_DBLIBNAME, luaopen_debug},
+#endif
   {NULL, NULL}
 };
 
