Index: external/mit/lua/dist/src/luaconf.h
===================================================================
RCS file: /cvsroot/src/external/mit/lua/dist/src/luaconf.h,v
retrieving revision 1.5
diff -u -r1.5 luaconf.h
--- external/mit/lua/dist/src/luaconf.h	2 Dec 2013 06:07:22 -0000	1.5
+++ external/mit/lua/dist/src/luaconf.h	4 Dec 2013 05:02:09 -0000
@@ -13,6 +13,9 @@
 #include <limits.h>
 #include <stddef.h>
 
+#ifdef _KERNEL
+#include <sys/types.h>
+#endif
 
 /*
 ** ==================================================================
@@ -149,7 +152,11 @@
 ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
 ** machines, ptrdiff_t gives a good choice between int or long.)
 */
+#ifdef _KERNEL
+#define LUA_INTEGER	LUA_NUMBER
+#else
 #define LUA_INTEGER	ptrdiff_t
+#endif
 
 
 /*
@@ -511,7 +518,7 @@
 */
 
 #ifdef _KERNEL
-#define LUA_NUMBER	int64_t
+#define LUA_NUMBER	intmax_t
 #else
 #define LUA_NUMBER_DOUBLE
 #define LUA_NUMBER	double
@@ -531,9 +538,9 @@
 @@ lua_str2number converts a string to a number.
 */
 #ifdef _KERNEL
-#define LUA_NUMBER_SCAN		"%" SCNd64
-#define LUA_NUMBER_FMT		"%" PRId64
-#define lua_str2number(s,p)	((int64_t) strtoimax((s), (p), 10))
+#define LUA_NUMBER_SCAN		"%jd"
+#define LUA_NUMBER_FMT		"%jd"
+#define lua_str2number(s,p)	strtoimax((s), (p), 10)
 #else
 #define LUA_NUMBER_SCAN		"%lf"
 #define LUA_NUMBER_FMT		"%.14g"
@@ -766,7 +773,13 @@
 ** CHANGE them if your system supports long long or does not support long.
 */
 
-#if defined(LUA_USELONGLONG)
+#ifdef _KERNEL
+
+#define LUA_INTFRMLEN		"j"
+#define LUA_INTFRM_T		intmax_t
+#define LUA_UINTFRM_T		uintmax_t
+
+#elif defined(LUA_USELONGLONG)
 
 #define LUA_INTFRMLEN		"ll"
 #define LUA_INTFRM_T		long long
Index: external/mit/lua/dist/src/lstrlib.c
===================================================================
RCS file: /cvsroot/src/external/mit/lua/dist/src/lstrlib.c,v
retrieving revision 1.2
diff -u -r1.2 lstrlib.c
--- external/mit/lua/dist/src/lstrlib.c	2 Dec 2013 23:06:35 -0000	1.2
+++ external/mit/lua/dist/src/lstrlib.c	4 Dec 2013 05:02:09 -0000
@@ -786,7 +786,11 @@
         }
         case 'o':  case 'u':  case 'x':  case 'X': {
           addintlen(form);
+#ifndef _KERNEL
           sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg));
+#else
+          sprintf(buff, form, (LUA_UINTFRM_T)luaL_checknumber(L, arg));
+#endif
           break;
         }
 #ifndef _KERNEL
