anchor.diff:           IF EXIST "%%L%%E\lua5.1.exe" (
               SET LUA_INTERPRETER=lua5.1.exe
               SET LUA_BINDIR=%%L%%E
  +            ECHO       Found .\%%E\!LUA_INTERPRETER!
               GOTO INTERPRETER_IS_SET
            )
            IF EXIST "%%L%%E\lua.exe" (
               SET LUA_INTERPRETER=lua.exe
               SET LUA_BINDIR=%%L%%E
  +            ECHO       Found .\%%E\!LUA_INTERPRETER!
               GOTO INTERPRETER_IS_SET
            )
            IF EXIST "%%L%%E\luajit.exe" (
               SET LUA_INTERPRETER=luajit.exe
               SET LUA_BINDIR=%%L%%E
  -            GOTO INTERPRETER_IS_SET
  -         )
  -      )
  +            ECHO       Found .\%%E\!LUA_INTERPRETER!
  +            GOTO INTERPRETER_IS_SET
  +         )
  +      )
  +      ECHO      No Lua interpreter found
         GOTO TRY_NEXT_LUA_DIR
         :INTERPRETER_IS_SET
  -      IF NOT "%LUA_LIBDIR%"=="" (
  -         IF EXIST %LUA_LIBDIR%\lua5.1.lib GOTO LIBDIR_IS_SET
  -         ECHO lua5.1.lib not found in %LUA_LIBDIR%
  +      ECHO Interpreter found, now looking for link libraries...
  +      IF NOT [%LUA_LIBDIR%]==[] (
  +         FOR %%T IN (%LUA_LIB_NAMES%) DO (
  +            ECHO    checking for %LUA_LIBDIR%\%%T
  +            IF EXIST "%LUA_LIBDIR%\%%T" (
  +               SET LUA_LIBNAME=%%T
  +               ECHO       Found %%T
  +               GOTO LIBDIR_IS_SET
  +            )
  +         )
  +         ECHO link library ^(one of; %LUA_LIB_NAMES%^) not found in %LUA_LIBDIR%
            GOTO ERROR
         )
         FOR %%E IN (\ \lib\ \bin\) DO (
  -         IF EXIST "%CURR%%%E\lua5.1.lib" (
  -            SET LUA_LIBDIR=%CURR%%%E
  -            GOTO LIBDIR_IS_SET
  +         FOR %%S IN (%LUA_LIB_NAMES%) DO (
  +            ECHO    checking for %CURR%%%E\%%S
  +            IF EXIST "%CURR%%%E\%%S" (
  +               SET LUA_LIBDIR=%CURR%%%E
  +               SET LUA_LIBNAME=%%S
  +               ECHO       Found %%S
  +               GOTO LIBDIR_IS_SET
  +            )
            )
         )
         GOTO TRY_NEXT_LUA_DIR
         :LIBDIR_IS_SET
  +      ECHO Link library found, now looking for headers...
         IF NOT [%LUA_INCDIR%]==[] (
  -         IF EXIST %LUA_INCDIR%\lua.h GOTO INCDIR_IS_SET
  +         ECHO    checking for %LUA_INCDIR%\lua.h
  +         IF EXIST %LUA_INCDIR%\lua.h (
  +            ECHO       Found lua.h
  +            GOTO INCDIR_IS_SET
  +         )
            ECHO lua.h not found in %LUA_INCDIR%
            GOTO ERROR
         )
         FOR %%E IN (\ \include\) DO (
  +         ECHO    checking for %CURR%%%E\lua.h
            IF EXIST "%CURR%%%E\lua.h" (
               SET LUA_INCDIR=%CURR%%%E
  +            ECHO       Found lua.h
               GOTO INCDIR_IS_SET
            )
         )
         GOTO TRY_NEXT_LUA_DIR
         :INCDIR_IS_SET
  -	%LUA_BINDIR%\%LUA_INTERPRETER% -v 2>NUL
  +      ECHO Headers found, now testing interpreter...
  +      %LUA_BINDIR%\%LUA_INTERPRETER% -v 2>NUL
         IF NOT ERRORLEVEL 1 (
  +         ECHO   Ok
            GOTO LUA_IS_SET
         )
  +      ECHO   Interpreter returned an error, not ok
      )
   :TRY_NEXT_LUA_DIR
      REM wtf
  
positive.code: 
  IF [%INSTALL_LUA%]==[ON] GOTO USE_OWN_LUA
  
  FOR %%L IN (%LUA_PREFIX% c:\lua\5.1.2 c:\lua c:\kepler\1.1) DO (
     SET CURR=%%L
     IF EXIST "%%L" (
        IF NOT [%LUA_BINDIR%]==[] (
           IF EXIST %LUA_BINDIR%\lua5.1.exe (
              SET LUA_INTERPRETER=lua5.1.exe
              GOTO INTERPRETER_IS_SET
           )
           IF EXIST %LUA_BINDIR%\lua.exe (
              SET LUA_INTERPRETER=lua.exe
              GOTO INTERPRETER_IS_SET
           )		 
           IF EXIST %LUA_BINDIR%\luajit.exe (
              SET LUA_INTERPRETER=luajit.exe
              GOTO INTERPRETER_IS_SET
           )		 
           ECHO Lua executable lua.exe, luajit.exe or lua5.1.exe not found in %LUA_BINDIR%
  
negative.code: SET LUA_BINDIR=
  SET LUA_INCDIR=
  SET LUA_LIBDIR=
  SET LUA_LIBNAME=
  SET FORCE_CONFIG=
  SET MKDIR=.\bin\mkdir -p
  SET LUA_LIB_NAMES=lua5.1.lib lua51.dll liblua.dll.a
  
  REM ***********************************************************
  REM Option parser
  REM ***********************************************************
  ECHO LuaRocks %VERSION%.x installer.
  ECHO.
  
  :PARSE_LOOP
  IF [%1]==[] GOTO DONE_PARSING
  