aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--llex.c2
-rw-r--r--lparser.c4
-rw-r--r--ltests.h1
-rw-r--r--luaconf.h12
-rw-r--r--manual/manual.of6
5 files changed, 20 insertions, 5 deletions
diff --git a/llex.c b/llex.c
index f8bb3ea4..7cd9fcaf 100644
--- a/llex.c
+++ b/llex.c
@@ -188,7 +188,7 @@ void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source,
188 so they cannot be collected */ 188 so they cannot be collected */
189 ls->envn = luaS_newliteral(L, LUA_ENV); /* get env string */ 189 ls->envn = luaS_newliteral(L, LUA_ENV); /* get env string */
190 ls->brkn = luaS_newliteral(L, "break"); /* get "break" string */ 190 ls->brkn = luaS_newliteral(L, "break"); /* get "break" string */
191#if defined(LUA_COMPAT_GLOBAL) 191#if LUA_COMPAT_GLOBAL
192 /* compatibility mode: "global" is not a reserved word */ 192 /* compatibility mode: "global" is not a reserved word */
193 ls->glbn = luaS_newliteral(L, "global"); /* get "global" string */ 193 ls->glbn = luaS_newliteral(L, "global"); /* get "global" string */
194 ls->glbn->extra = 0; /* mark it as not reserved */ 194 ls->glbn->extra = 0; /* mark it as not reserved */
diff --git a/lparser.c b/lparser.c
index b27463af..6b87773e 100644
--- a/lparser.c
+++ b/lparser.c
@@ -1685,7 +1685,7 @@ static void forbody (LexState *ls, int base, int line, int nvars, int isgen) {
1685/* 1685/*
1686** Control whether for-loop control variables are read-only 1686** Control whether for-loop control variables are read-only
1687*/ 1687*/
1688#if defined(LUA_COMPAT_LOOPVAR) 1688#if LUA_COMPAT_LOOPVAR
1689#define LOOPVARKIND VDKREG 1689#define LOOPVARKIND VDKREG
1690#else /* by default, these variables are read only */ 1690#else /* by default, these variables are read only */
1691#define LOOPVARKIND RDKCONST 1691#define LOOPVARKIND RDKCONST
@@ -2120,7 +2120,7 @@ static void statement (LexState *ls) {
2120 gotostat(ls, line); 2120 gotostat(ls, line);
2121 break; 2121 break;
2122 } 2122 }
2123#if defined(LUA_COMPAT_GLOBAL) 2123#if LUA_COMPAT_GLOBAL
2124 case TK_NAME: { 2124 case TK_NAME: {
2125 /* compatibility code to parse global keyword when "global" 2125 /* compatibility code to parse global keyword when "global"
2126 is not reserved */ 2126 is not reserved */
diff --git a/ltests.h b/ltests.h
index 93096da8..f5f14cd6 100644
--- a/ltests.h
+++ b/ltests.h
@@ -14,6 +14,7 @@
14/* test Lua with compatibility code */ 14/* test Lua with compatibility code */
15#define LUA_COMPAT_MATHLIB 15#define LUA_COMPAT_MATHLIB
16#undef LUA_COMPAT_GLOBAL 16#undef LUA_COMPAT_GLOBAL
17#define LUA_COMPAT_GLOBAL 0
17 18
18 19
19#define LUA_DEBUG 20#define LUA_DEBUG
diff --git a/luaconf.h b/luaconf.h
index f076c984..1b72e338 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -70,15 +70,19 @@
70#if defined(LUA_USE_LINUX) 70#if defined(LUA_USE_LINUX)
71#define LUA_USE_POSIX 71#define LUA_USE_POSIX
72#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ 72#define LUA_USE_DLOPEN /* needs an extra library: -ldl */
73#if !defined(LUA_READLINELIB)
73#define LUA_READLINELIB "libreadline.so" 74#define LUA_READLINELIB "libreadline.so"
74#endif 75#endif
76#endif
75 77
76 78
77#if defined(LUA_USE_MACOSX) 79#if defined(LUA_USE_MACOSX)
78#define LUA_USE_POSIX 80#define LUA_USE_POSIX
79#define LUA_USE_DLOPEN /* macOS does not need -ldl */ 81#define LUA_USE_DLOPEN /* macOS does not need -ldl */
82#if !defined(LUA_READLINELIB)
80#define LUA_READLINELIB "libedit.dylib" 83#define LUA_READLINELIB "libedit.dylib"
81#endif 84#endif
85#endif
82 86
83 87
84#if defined(LUA_USE_IOS) 88#if defined(LUA_USE_IOS)
@@ -339,14 +343,18 @@
339/* 343/*
340@@ LUA_COMPAT_GLOBAL avoids 'global' being a reserved word 344@@ LUA_COMPAT_GLOBAL avoids 'global' being a reserved word
341*/ 345*/
342#define LUA_COMPAT_GLOBAL 346#if !defined(LUA_COMPAT_GLOBAL)
347#define LUA_COMPAT_GLOBAL 1
348#endif
343 349
344 350
345/* 351/*
346@@ LUA_COMPAT_LOOPVAR makes for-loop control variables not read-only, 352@@ LUA_COMPAT_LOOPVAR makes for-loop control variables not read-only,
347** as they were in previous versions. 353** as they were in previous versions.
348*/ 354*/
349/* #define LUA_COMPAT_LOOPVAR */ 355#if !defined(LUA_COMPAT_LOOPVAR)
356#define LUA_COMPAT_LOOPVAR 0
357#endif
350 358
351 359
352/* 360/*
diff --git a/manual/manual.of b/manual/manual.of
index 5fa4e097..09075346 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -9594,12 +9594,18 @@ change between versions.
9594@item{ 9594@item{
9595The word @Rw{global} is a reserved word. 9595The word @Rw{global} is a reserved word.
9596Do not use it as a regular name. 9596Do not use it as a regular name.
9597
9598The compilation option @id{LUA_COMPAT_GLOBAL} (see @id{luaconf.h})
9599makes @id{global} a regular word.
9597} 9600}
9598 9601
9599@item{ 9602@item{
9600The control variable in @Rw{for} loops is read only. 9603The control variable in @Rw{for} loops is read only.
9601If you need to change it, 9604If you need to change it,
9602declare a local variable with the same name in the loop body. 9605declare a local variable with the same name in the loop body.
9606
9607The compilation option @id{LUA_COMPAT_LOOPVAR} (see @id{luaconf.h})
9608makes these variables regular (writable).
9603} 9609}
9604 9610
9605@item{ 9611@item{