diff --git a/src/blua/llex.c b/src/blua/llex.c
index 9e3dc2929b7ffa407dfa7303a08b7cbc1f0f8970..742319b0c985cf8022ac812deaf33d9731f14973 100644
--- a/src/blua/llex.c
+++ b/src/blua/llex.c
@@ -38,7 +38,7 @@
 const char *const luaX_tokens [] = {
     "and", "break", "continue", "do", "else", "elseif",
     "end", "false", "for", "function", "if",
-    "in", "local", "nil", "not", "or", "repeat",
+    "in", "local", "global", "nil", "not", "or", "repeat",
     "return", "then", "true", "until", "while",
     "..", "...", "==", ">=", "<=", "~=",
     "<number>", "<name>", "<string>", "<eof>",
diff --git a/src/blua/llex.h b/src/blua/llex.h
index 3f55c75cdc1a75ea11932a75a59eda7635d4019c..4da3fe9f30102ea5610ae6a8658356ab3dfd24f3 100644
--- a/src/blua/llex.h
+++ b/src/blua/llex.h
@@ -25,7 +25,7 @@ enum RESERVED {
   /* terminal symbols denoted by reserved words */
   TK_AND = FIRST_RESERVED, TK_BREAK, TK_CONTINUE,
   TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION,
-  TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
+  TK_IF, TK_IN, TK_LOCAL, TK_GLOBAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
   TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
   /* other terminal symbols */
   TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER,
diff --git a/src/blua/lparser.c b/src/blua/lparser.c
index 4b1d2ffb90a5dc0d861e95361ddf148af6661a58..48b70d2ab9b0e5b52b4173cc03ce7c129fbb6215 100644
--- a/src/blua/lparser.c
+++ b/src/blua/lparser.c
@@ -1349,6 +1349,16 @@ static void localfunc (LexState *ls) {
 }
 
 
+static void globalfunc (LexState *ls) {
+  expdesc v, b;
+  FuncState *fs = ls->fs;
+  init_exp(&v, VGLOBAL, NO_REG);
+  v.u.s.info = luaK_stringK(fs, str_checkname(ls));
+  body(ls, &b, 0, ls->linenumber);
+  luaK_storevar(fs, &v, &b);
+}
+
+
 static void localstat (LexState *ls) {
   /* stat -> LOCAL NAME {`,' NAME} [`=' explist1] */
   int nvars = 0;
@@ -1485,6 +1495,12 @@ static int statement (LexState *ls) {
         localstat(ls);
       return 0;
     }
+    case TK_GLOBAL: {  /* stat -> globalstat */
+      luaX_next(ls);   /* skip GLOBAL */
+      if (testnext(ls, TK_FUNCTION))
+        globalfunc(ls);
+      return 0;
+    }
     case TK_RETURN: {  /* stat -> retstat */
       retstat(ls);
       return 1;  /* must be last statement */