diff -up ../../lua-5.1.4/src/llex.c src/llex.c
--- ../../lua-5.1.4/src/llex.c	Thu Dec 27 13:02:26 2007
+++ src/llex.c	Thu Jun 11 14:00:46 2009
@@ -35,7 +35,7 @@
 
 /* ORDER RESERVED */
 const char *const luaX_tokens [] = {
-    "and", "break", "do", "else", "elseif",
+    "and", "break", "continue", "do", "else", "elseif",
     "end", "false", "for", "function", "if",
     "in", "local", "nil", "not", "or", "repeat",
     "return", "then", "true", "until", "while",
diff -up ../../lua-5.1.4/src/llex.h src/llex.h
--- ../../lua-5.1.4/src/llex.h	Thu Dec 27 13:02:26 2007
+++ src/llex.h	Fri Jun 12 12:12:14 2009
@@ -23,7 +23,7 @@
 */
 enum RESERVED {
   /* terminal symbols denoted by reserved words */
-  TK_AND = FIRST_RESERVED, TK_BREAK,
+  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_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
diff -up ../../lua-5.1.4/src/lparser.c src/lparser.c
--- ../../lua-5.1.4/src/lparser.c	Fri Dec 28 15:32:24 2007
+++ src/lparser.c	Fri Jun 12 12:18:09 2009
@@ -40,9 +40,11 @@
 typedef struct BlockCnt {
   struct BlockCnt *previous;  /* chain */
   int breaklist;  /* list of jumps out of this loop */
+  int continuelist;  /* list of jumps onto next loop iteration */
   lu_byte nactvar;  /* # active locals outside the breakable structure */
   lu_byte upval;  /* true if some variable in the block is an upvalue */
   lu_byte isbreakable;  /* true if `block' is a loop */
+  lu_byte continuepos;  /* index of first prohibited local if after a continue */
 } BlockCnt;
 
 
@@ -207,8 +209,18 @@ static int indexupvalue (FuncState *fs, 
 static int searchvar (FuncState *fs, TString *n) {
   int i;
   for (i=fs->nactvar-1; i >= 0; i--) {
-    if (n == getlocvar(fs, i).varname)
+    if (n == getlocvar(fs, i).varname) {
+      if (i >= fs->prohibitedloc) {
+        BlockCnt *bl = fs->bl;
+        int line;
+        while (bl->continuelist == NO_JUMP)
+          bl = bl->previous;
+        line = fs->f->lineinfo[bl->continuelist];
+        fs->ls->linenumber = fs->ls->lastline; /* Go back to the name token for the error message line number */
+        luaX_lexerror(fs->ls, luaO_pushfstring(fs->L, "use of variable " LUA_QS " is not permitted in this context as its initialisation could have been skipped by the " LUA_QL("continue") " statement on line %d", n + 1, line), 0);
+      }
       return i;
+    }
   }
   return -1;  /* not found */
 }
@@ -284,9 +296,11 @@ static void enterlevel (LexState *ls) {
 
 static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) {
   bl->breaklist = NO_JUMP;
+  bl->continuelist = NO_JUMP;
   bl->isbreakable = isbreakable;
   bl->nactvar = fs->nactvar;
   bl->upval = 0;
+  bl->continuepos = 0;
   bl->previous = fs->bl;
   fs->bl = bl;
   lua_assert(fs->freereg == fs->nactvar);
@@ -297,6 +311,7 @@ static void leaveblock (FuncState *fs) {
   BlockCnt *bl = fs->bl;
   fs->bl = bl->previous;
   removevars(fs->ls, bl->nactvar);
+  luaK_patchtohere(fs, bl->continuelist);
   if (bl->upval)
     luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0);
   /* a block either controls scope or breaks (never both) */
@@ -339,6 +354,7 @@ static void open_func (LexState *ls, Fun
   fs->freereg = 0;
   fs->nk = 0;
   fs->np = 0;
+  fs->prohibitedloc = LUAI_MAXVARS + 1;  /* nothing prohibited */
   fs->nlocvars = 0;
   fs->nactvar = 0;
   fs->bl = NULL;
@@ -988,6 +1004,32 @@ static void breakstat (LexState *ls) {
 }
 
 
+static void continuestat (LexState *ls) {
+  FuncState *fs = ls->fs;
+  BlockCnt *bl = fs->bl;
+  int continuepos = fs->nactvar;
+  {
+    BlockCnt *b2 = bl;
+    if (b2)
+    {
+      b2 = b2->previous;
+      while (b2 && !b2->isbreakable) {
+        continuepos = bl->nactvar;
+        bl = b2;
+        b2 = b2->previous;
+      }
+    }
+    if (!b2)
+      luaX_syntaxerror(ls, "no loop to continue");
+    /* b2 is a loop block, bl is the scope block just above it,
+       continuepos is the nactvar of the scope above that */
+  }
+  if (bl->continuelist == NO_JUMP)
+    bl->continuepos = continuepos;
+  luaK_concat(fs, &bl->continuelist, luaK_jump(fs));
+}
+
+
 static void whilestat (LexState *ls, int line) {
   /* whilestat -> WHILE cond DO block END */
   FuncState *fs = ls->fs;
@@ -1018,7 +1060,17 @@ static void repeatstat (LexState *ls, in
   luaX_next(ls);  /* skip REPEAT */
   chunk(ls);
   check_match(ls, TK_UNTIL, TK_REPEAT, line);
-  condexit = cond(ls);  /* read condition (inside scope block) */
+  if (bl2.continuelist != NO_JUMP) {
+    int oldprohibition = fs->prohibitedloc;
+    luaK_patchtohere(fs, bl2.continuelist);
+    fs->prohibitedloc = bl2.continuepos;
+    condexit = cond(ls);  /* read condition (inside scope block) */
+    fs->prohibitedloc = oldprohibition;
+    bl2.continuelist = NO_JUMP;
+  }
+  else {
+    condexit = cond(ls);  /* read condition (inside scope block) */
+  }
   if (!bl2.upval) {  /* no upvalues? */
     leaveblock(fs);  /* finish scope */
     luaK_patchlist(ls->fs, condexit, repeat_init);  /* close the loop */
@@ -1312,6 +1364,11 @@ static int statement (LexState *ls) {
     case TK_BREAK: {  /* stat -> breakstat */
       luaX_next(ls);  /* skip BREAK */
       breakstat(ls);
+      return 1;  /* must be last statement */
+    }
+    case TK_CONTINUE: { /* stat -> continuestat */
+      luaX_next(ls);  /* skip CONTINUE */
+      continuestat(ls);
       return 1;  /* must be last statement */
     }
     default: {
diff -up ../../lua-5.1.4/src/lparser.h src/lparser.h
--- ../../lua-5.1.4/src/lparser.h	Thu Dec 27 13:02:26 2007
+++ src/lparser.h	Thu Jun 11 16:33:46 2009
@@ -68,6 +68,7 @@ typedef struct FuncState {
   int freereg;  /* first free register */
   int nk;  /* number of elements in `k' */
   int np;  /* number of elements in `p' */
+  int prohibitedloc;  /* index (into actvar) of first prohibited local */
   short nlocvars;  /* number of elements in `locvars' */
   lu_byte nactvar;  /* number of active local variables */
   upvaldesc upvalues[LUAI_MAXUPVALUES];  /* upvalues */
