History

Lua 5.1-rc2

Lua Team committed 20 years ago

Commit 2fee0d61 parent 53d3c3216 files · +95 −59Browse files

Unified · Split

16 files
  1. HISTORY +2 −1
  2. INSTALL +2 −2
  3. MANIFEST +1 −1
  4. Makefile +9 −4
  5. README +3 −1
  6. doc/manual.html +22 −12
  7. etc/lua.pc +5 −2
  8. src/Makefile +10 −4
  9. src/lauxlib.c +19 −9
  10. src/lbaselib.c +2 −2
  11. src/liolib.c +5 −4
  12. src/llex.c +4 −6
  13. src/lobject.h +1 −4
  14. src/ltable.c +2 −2
  15. src/luaconf.h +3 −2
  16. src/lvm.c +5 −3
HISTORY+2−1
@@ -1,4 +1,4 @@
1This is Lua 5.1.1HISTORY for Lua 5.1
2 2
3* Changes from version 5.0 to 5.13* Changes from version 5.0 to 5.1
4 -------------------------------4 -------------------------------
@@ -14,6 +14,7 @@ This is Lua 5.1. · 9 unmodified lines
14 API:14 API:
15 + new functions: lua_createtable, lua_get(set)field, lua_push(to)integer.15 + new functions: lua_createtable, lua_get(set)field, lua_push(to)integer.
16 + user supplies memory allocator (lua_open becomes lua_newstate).16 + user supplies memory allocator (lua_open becomes lua_newstate).
17 + luaopen_* functionst be called through Lua.
17 Implementation:18 Implementation:
18 + new configuration scheme via luaconf.h.19 + new configuration scheme via luaconf.h.
19 + incremental garbage collection.20 + incremental garbage collection.
INSTALL+2−2
@@ -1,4 +1,4 @@
1This is Lua 5.1.1INSTALL for Lua 5.1
2 2
3* Building Lua3* Building Lua
4 ------------4 ------------
@@ -8,7 +8,7 @@ This is Lua 5.1. · 3 unmodified lines
8 Building Lua on Unix systems should be very easy. First do "make" and8 Building Lua on Unix systems should be very easy. First do "make" and
9 see if your platform is listed. If so, just do "make xxx", where xxx9 see if your platform is listed. If so, just do "make xxx", where xxx
10 is your platform name. The platforms currently supported are:10 is your platform name. The platforms currently supported are:
11 ansi bsd generic linux macosx mingw posix11 ansi bsd generic linux macosx mingw posix solaris
12 12
13 See below for customization instructions and for instructions on how13 See below for customization instructions and for instructions on how
14 to build with other Windows compilers.14 to build with other Windows compilers.
MANIFEST+1−1
@@ -1,4 +1,4 @@
1MANIFEST contents of Lua 5.1 distribution on Wed Jan 11 22:50:45 BRST 20061MANIFEST contents of Lua 5.1 distribution on Tue Jan 24 16:12:03 BRST 2006
2lua-5.12lua-5.1
3lua-5.1/COPYRIGHT3lua-5.1/COPYRIGHT
4lua-5.1/doc4lua-5.1/doc
Makefile+9−4
@@ -16,6 +16,8 @@ INSTALL_BIN= $(INSTALL_TOP)/bin · 15 unmodified lines
16INSTALL_INC= $(INSTALL_TOP)/include16INSTALL_INC= $(INSTALL_TOP)/include
17INSTALL_LIB= $(INSTALL_TOP)/lib17INSTALL_LIB= $(INSTALL_TOP)/lib
18INSTALL_MAN= $(INSTALL_TOP)/man/man118INSTALL_MAN= $(INSTALL_TOP)/man/man1
19INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
20INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
19 21
20# How to install. You may prefer "install" instead of "cp" if you have it.22# How to install. You may prefer "install" instead of "cp" if you have it.
21# To remove debug information from binaries, use "install -s" in INSTALL_EXEC.23# To remove debug information from binaries, use "install -s" in INSTALL_EXEC.
@@ -28,7 +30,7 @@ INSTALL_DATA= cp · 6 unmodified lines
28# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========30# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
29 31
30# Convenience platforms targets.32# Convenience platforms targets.
31PLATS= ansi bsd generic linux macosx mingw posix33PLATS= ansi bsd generic linux macosx mingw posix solaris
32 34
33# What to install.35# What to install.
34TO_BIN= lua luac36TO_BIN= lua luac
@@ -39,7 +41,7 @@ TO_MAN= lua.1 luac.1 · 4 unmodified lines
39# Lua version. Currently used only for messages.41# Lua version. Currently used only for messages.
40V= 5.142V= 5.1
41 43
42all: $(PLAT)44all: $(PLAT)
43 45
44$(PLATS) clean:46$(PLATS) clean:
45 cd src; $(MAKE) $@47 cd src; $(MAKE) $@
@@ -47,8 +49,8 @@ $(PLATS) clean: · 1 unmodified line
47test: all49test: all
48 src/lua test/hello.lua50 src/lua test/hello.lua
49 51
50install: all52install:
51 cd src; mkdir -p $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN)53 cd src; mkdir -p $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
52 cd src; $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)54 cd src; $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
53 cd src; $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)55 cd src; $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
54 cd src; $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)56 cd src; $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
@@ -77,6 +79,9 @@ echo: · 22 unmodified lines
77 @echo "INSTALL_MAN = $(INSTALL_MAN)"79 @echo "INSTALL_MAN = $(INSTALL_MAN)"
78 @echo "INSTALL_EXEC = $(INSTALL_EXEC)"80 @echo "INSTALL_EXEC = $(INSTALL_EXEC)"
79 @echo "INSTALL_DATA = $(INSTALL_DATA)"81 @echo "INSTALL_DATA = $(INSTALL_DATA)"
82 @echo "INSTALL_LMOD = $(INSTALL_LMOD)"
83 @echo "INSTALL_CMOD = $(INSTALL_CMOD)"
84 @echo "INSTALL_CMOD = $(INSTALL_CMOD)"
80 @echo ""85 @echo ""
81 @echo "See also src/luaconf.h ."86 @echo "See also src/luaconf.h ."
82 @echo ""87 @echo ""
README+3−1
@@ -1,4 +1,6 @@
1This is Lua 5.1.1README for Lua 5.1
2
3See INSTALL for installation instructions.
2See HISTORY for a summary of changes since the last released version.4See HISTORY for a summary of changes since the last released version.
3 5
4* What is Lua?6* What is Lua?
doc/manual.html+22−12
@@ -1174,7 +1174,7 @@ while all of them share the same <code>x</code>. · 1173 unmodified lines
1174 1174
1175<p>Because Lua is an embedded extension language,1175<p>Because Lua is an embedded extension language,
1176all Lua actions start from C code in the host program1176all Lua actions start from C code in the host program
1177calling a function from the Lua library (see <a href="#lua_pcall"></a>).1177calling a function from the Lua library (see <a href="#lua_pcall"><code>lua_pcall</code></a>).
1178Whenever an error occurs during Lua compilation or execution,1178Whenever an error occurs during Lua compilation or execution,
1179control returns to C,1179control returns to C,
1180which can take appropriate measures1180which can take appropriate measures
@@ -1509,11 +1509,11 @@ called when Lua calls a value. · 328 unmodified lines
1509<pre>1509<pre>
1510 function function_event (func, ...)1510 function function_event (func, ...)
1511 if type(func) == "function" then1511 if type(func) == "function" then
1512 return func(unpack(arg)) -- primitive call1512 return func(...) -- primitive call
1513 else1513 else
1514 local h = metatable(func).__call1514 local h = metatable(func).__call
1515 if h then1515 if h then
1516 return h(func, unpack(arg))1516 return h(func, ...)
1517 else1517 else
1518 error("...")1518 error("...")
1519 end1519 end
@@ -1553,7 +1553,7 @@ all accesses to global variables within that function (see <a href="#variables"> · 33 unmodified lines
1553They are used as the default environment for other Lua functions1553They are used as the default environment for other Lua functions
1554created by that function.1554created by that function.
1555 1555
1556<p>You can change the environment of a Lua function of the1556<p>You can change the environment of a Lua function or the
1557running thread calling <a href="#pdf-setfenv"><code>setfenv</code></a>.1557running thread calling <a href="#pdf-setfenv"><code>setfenv</code></a>.
1558You can get the environment of a Lua function or the running thread1558You can get the environment of a Lua function or the running thread
1559calling <a href="#pdf-getfenv"><code>getfenv</code></a>.1559calling <a href="#pdf-getfenv"><code>getfenv</code></a>.
@@ -1565,8 +1565,8 @@ use the C API. · 5 unmodified lines
1565 1565
1566<p>Lua performs automatic memory management.1566<p>Lua performs automatic memory management.
1567That means that1567That means that
1568you do not have to worry about allocating memory for new objects1568you do not have to worry neither about allocating memory for new objects
1569not about freeing it when the objects are no longer needed.1569nor about freeing it when the objects are no longer needed.
1570Lua manages memory automatically by running1570Lua manages memory automatically by running
1571a <em>garbage collector</em> from time to time1571a <em>garbage collector</em> from time to time
1572to collect all <em>dead objects</em>1572to collect all <em>dead objects</em>
@@ -2821,7 +2821,7 @@ onto the stack. · 1248 unmodified lines
2821Lua makes (or reuses) an internal copy of the given string,2821Lua makes (or reuses) an internal copy of the given string,
2822so the memory at <code>s</code> can be freed or reused immediately after2822so the memory at <code>s</code> can be freed or reused immediately after
2823the function returns.2823the function returns.
2824The string cannot embedded zeros;2824The string cannot contain embedded zeros;
2825it is assumed to end at the first zero.2825it is assumed to end at the first zero.
2826 2826
2827<p><a name="lua_pushthread"></a>2827<p><a name="lua_pushthread"></a>
@@ -3609,7 +3609,7 @@ or when it jumps back in the code (even to the same line). · 781 unmodified lines
3609 3609
3610<p>Sets the value of a local variable of a given activation record.3610<p>Sets the value of a local variable of a given activation record.
3611Parameters <code>ar</code> and <code>n</code> are as in <a href="#lua_getlocal"><code>lua_getlocal</code></a>3611Parameters <code>ar</code> and <code>n</code> are as in <a href="#lua_getlocal"><code>lua_getlocal</code></a>
3612(see <a href="#lua_getlocal"></a>).3612(see <a href="#lua_getlocal"><code>lua_getlocal</code></a>).
3613<a href="#lua_setlocal"><code>lua_setlocal</code></a> assigns the value at the top of the stack3613<a href="#lua_setlocal"><code>lua_setlocal</code></a> assigns the value at the top of the stack
3614to the variable and returns its name.3614to the variable and returns its name.
3615It also pops the value from the stack.3615It also pops the value from the stack.
@@ -3627,7 +3627,7 @@ the number of active local variables. · 11 unmodified lines
3627 3627
3628<p>Sets the value of a closure's upvalue.3628<p>Sets the value of a closure's upvalue.
3629Parameters <code>funcindex</code> and <code>n</code> are as in <a href="#lua_getupvalue"><code>lua_getupvalue</code></a>3629Parameters <code>funcindex</code> and <code>n</code> are as in <a href="#lua_getupvalue"><code>lua_getupvalue</code></a>
3630(see <a href="#lua_getupvalue"></a>).3630(see <a href="#lua_getupvalue"><code>lua_getupvalue</code></a>).
3631It assigns the value at the top of the stack3631It assigns the value at the top of the stack
3632to the upvalue and returns its name.3632to the upvalue and returns its name.
3633It also pops the value from the stack.3633It also pops the value from the stack.
@@ -3995,9 +3995,9 @@ in the registry (see <a href="#luaL_newmetatable"><code>luaL_newmetatable</code> · 361 unmodified lines
3995</pre>3995</pre>
3996 3996
3997 3997
3998<p>Creates a copy of string <code>s</code> by replacing any occurrence3998<p>Creates a copy of string <code>s</code> by replacing
3999any occurrence of the string <code>p</code>3999any occurrence of the string <code>p</code>
4000wth the string <code>r</code>.4000with the string <code>r</code>.
4001Pushes the resulting string on the stack and returns it.4001Pushes the resulting string on the stack and returns it.
4002 4002
4003<p><a name="luaL_loadbuffer"></a>4003<p><a name="luaL_loadbuffer"></a>
@@ -5302,6 +5302,8 @@ of table <code>t</code>. · 1298 unmodified lines
5302 5302
5303<p>Returns the largest positive numerical index of the given table,5303<p>Returns the largest positive numerical index of the given table,
5304or zero if the table has no positive numerical indices.5304or zero if the table has no positive numerical indices.
5305(To do its job this function does a linear traversal of
5306the whole table.)
5305 5307
5306<p><a name="pdf-table.remove"></a><hr /><h3><code>table.remove (table [, pos])</code></h3>5308<p><a name="pdf-table.remove"></a><hr /><h3><code>table.remove (table [, pos])</code></h3>
5307 5309
@@ -6076,7 +6078,15 @@ use <code>collectgarbage("count")</code> instead. · 768 unmodified lines
6076 6078
6077<p><h3>Changes in the API</h3>6079<p><h3>Changes in the API</h3>
6078<ul>6080<ul>
6079<li>6081
6082<p><li>
6083The <code>luaopen_*</code> functions (to open libraries)
6084cannot be called directly,
6085like a regular C function.
6086They must be called through Lua,
6087like a Lua function.
6088
6089<p><li>
6080Function <code>lua_open</code> was replaced by <a href="#lua_newstate"><code>lua_newstate</code></a> to6090Function <code>lua_open</code> was replaced by <a href="#lua_newstate"><code>lua_newstate</code></a> to
6081allow the user to set a memory allocation function.6091allow the user to set a memory allocation function.
6082You can use <a href="#luaL_newstate"><code>luaL_newstate</code></a> from the standard library to6092You can use <a href="#luaL_newstate"><code>luaL_newstate</code></a> from the standard library to
etc/lua.pc+5−2
@@ -1,13 +1,16 @@
1# lua.pc -- pkg-config data for Lua1# lua.pc -- pkg-config data for Lua
2 2
3# vars from install Makefile3# vars from install Makefile
4# grep ^INSTALL_...= ../Makefile4# grep '^INSTALL_.*=' ../Makefile
5INSTALL_TOP= /usr/local5INSTALL_TOP= /usr/local
6INSTALL_BIN= $(INSTALL_TOP)/bin6INSTALL_BIN= $(INSTALL_TOP)/bin
7INSTALL_INC= $(INSTALL_TOP)/include7INSTALL_INC= $(INSTALL_TOP)/include
8INSTALL_LIB= $(INSTALL_TOP)/lib8INSTALL_LIB= $(INSTALL_TOP)/lib
9INSTALL_MAN= $(INSTALL_TOP)/man/man19INSTALL_MAN= $(INSTALL_TOP)/man/man1
10# grep ^V= ../Makefile10INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
11INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
12
13# grep '^V=' ../Makefile
11V= 5.114V= 5.1
12 15
13prefix=${INSTALL_TOP}16prefix=${INSTALL_TOP}
src/Makefile+10−4
@@ -1,5 +1,5 @@
1# makefile for building Lua1# makefile for building Lua
2# see INSTALL for installation instructions2# see ../INSTALL for installation instructions
3# see ../Makefile and luaconf.h for further customization3# see ../Makefile and luaconf.h for further customization
4 4
5# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================5# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
@@ -20,7 +20,7 @@ MYLIBS= · 14 unmodified lines
20 20
21# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========21# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
22 22
23PLATS= ansi bsd generic linux macosx mingw posix23PLATS= ansi bsd generic linux macosx mingw posix solaris
24 24
25LUA_A= liblua.a25LUA_A= liblua.a
26CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \26CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
@@ -74,7 +74,7 @@ echo: · 47 unmodified lines
74 @echo "MYLDFLAGS = $(MYLDFLAGS)"74 @echo "MYLDFLAGS = $(MYLDFLAGS)"
75 @echo "MYLIBS = $(MYLIBS)"75 @echo "MYLIBS = $(MYLIBS)"
76 76
77# convenience targets for usual platforms77# convenience targets for popular platforms
78 78
79none:79none:
80 @echo "Please choose a platform: $(PLATS)"80 @echo "Please choose a platform: $(PLATS)"
@@ -93,15 +93,21 @@ linux: · 12 unmodified lines
93 93
94macosx:94macosx:
95 $(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX95 $(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX
96# use this on Mac OS X 10.4
97# $(MAKE) all MYCFLAGS="-DLUA_USE_MACOSX -DLUA_USE_READLINE" MYLIBS="-lreadline"
96 98
97mingw:99mingw:
98 $(MAKE) "LUA_A=lua51.dll" "LUA_T=lua.exe" \100 $(MAKE) "LUA_A=lua51.dll" "LUA_T=lua.exe" \
99 "AR=gcc -shared -o" "RANLIB=strip --strip-unneeded" \101 "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \
100 "MYCFLAGS=-DLUA_BUILD_AS_DLL" "MYLIBS=" "MYLDFLAGS=-s" lua.exe102 "MYCFLAGS=-DLUA_BUILD_AS_DLL" "MYLIBS=" "MYLDFLAGS=-s" lua.exe
101 103
102posix:104posix:
103 $(MAKE) all MYCFLAGS=-DLUA_USE_POSIX105 $(MAKE) all MYCFLAGS=-DLUA_USE_POSIX
104 106
107solaris:
108 $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl"
109
110
105# DO NOT DELETE111# DO NOT DELETE
106 112
107lapi.o: lapi.c lua.h luaconf.h lapi.h lobject.h llimits.h ldebug.h \113lapi.o: lapi.c lua.h luaconf.h lapi.h lobject.h llimits.h ldebug.h \
src/lauxlib.c+19−9
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lauxlib.c,v 1.157 2005/12/29 15:32:11 roberto Exp $2** $Id: lauxlib.c,v 1.158 2006/01/16 12:42:21 roberto Exp $
3** Auxiliary functions for building Lua libraries3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -295,23 +295,33 @@ static void getsizes (lua_State *L) { · 289 unmodified lines
295 295
296LUALIB_API void luaL_setn (lua_State *L, int t, int n) {296LUALIB_API void luaL_setn (lua_State *L, int t, int n) {
297 t = abs_index(L, t);297 t = abs_index(L, t);
298 getsizes(L);298 lua_pushliteral(L, "n");
299 lua_pushvalue(L, t);299 lua_rawget(L, t);
300 lua_pushinteger(L, n);300 if (checkint(L, 1) >= 0) { /* is there a numeric field `n'? */
301 lua_rawset(L, -3); /* sizes[t] = n */301 lua_pushliteral(L, "n"); /* use it */
302 lua_pop(L, 1); /* remove `sizes' */302 lua_pushinteger(L, n);
303 lua_rawset(L, t);
304 }
305 else { /* use `sizes' */
306 getsizes(L);
307 lua_pushvalue(L, t);
308 lua_pushinteger(L, n);
309 lua_rawset(L, -3); /* sizes[t] = n */
310 lua_pop(L, 1); /* remove `sizes' */
311 }
303}312}
304 313
305 314
306LUALIB_API int luaL_getn (lua_State *L, int t) {315LUALIB_API int luaL_getn (lua_State *L, int t) {
307 int n;316 int n;
308 t = abs_index(L, t);317 t = abs_index(L, t);
309 getsizes(L); /* try sizes[t] */318 lua_pushliteral(L, "n"); /* try t.n */
319 lua_rawget(L, t);
320 if ((n = checkint(L, 1)) >= 0) return n;
321 getsizes(L); /* else try sizes[t] */
310 lua_pushvalue(L, t);322 lua_pushvalue(L, t);
311 lua_rawget(L, -2);323 lua_rawget(L, -2);
312 if ((n = checkint(L, 2)) >= 0) return n;324 if ((n = checkint(L, 2)) >= 0) return n;
313 lua_getfield(L, t, "n"); /* else try t.n */
314 if ((n = checkint(L, 1)) >= 0) return n;
315 return (int)lua_objlen(L, t);325 return (int)lua_objlen(L, t);
316}326}
317 327
src/lbaselib.c+2−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lbaselib.c,v 1.188 2005/12/29 15:32:11 roberto Exp $2** $Id: lbaselib.c,v 1.189 2006/01/18 11:49:12 roberto Exp $
3** Basic library3** Basic library
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -201,7 +201,7 @@ static int luaB_collectgarbage (lua_State *L) { · 195 unmodified lines
201 switch (optsnum[o]) {201 switch (optsnum[o]) {
202 case LUA_GCCOUNT: {202 case LUA_GCCOUNT: {
203 int b = lua_gc(L, LUA_GCCOUNTB, 0);203 int b = lua_gc(L, LUA_GCCOUNTB, 0);
204 lua_pushnumber(L, ((lua_Number)res*1024 + b)/1024);204 lua_pushnumber(L, res + ((lua_Number)b/1024));
205 return 1;205 return 1;
206 }206 }
207 case LUA_GCSTEP: {207 case LUA_GCSTEP: {
src/liolib.c+5−4
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: liolib.c,v 2.70 2005/12/29 15:32:11 roberto Exp $2** $Id: liolib.c,v 2.71 2006/01/17 13:54:02 roberto Exp $
3** Standard I/O (and system) library3** Standard I/O (and system) library
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -28,6 +28,7 @@ static const char *const fnames[] = {"input", "output"}; · 22 unmodified lines
28 28
29 29
30static int pushresult (lua_State *L, int i, const char *filename) {30static int pushresult (lua_State *L, int i, const char *filename) {
31 int en = errno; /* calls to Lua API may change this value */
31 if (i) {32 if (i) {
32 lua_pushboolean(L, 1);33 lua_pushboolean(L, 1);
33 return 1;34 return 1;
@@ -35,10 +36,10 @@ static int pushresult (lua_State *L, int i, const char *filename) { · 1 unmodified line
35 else {36 else {
36 lua_pushnil(L);37 lua_pushnil(L);
37 if (filename)38 if (filename)
38 lua_pushfstring(L, "%s: %s", filename, strerror(errno));39 lua_pushfstring(L, "%s: %s", filename, strerror(en));
39 else40 else
40 lua_pushfstring(L, "%s", strerror(errno));41 lua_pushfstring(L, "%s", strerror(en));
41 lua_pushinteger(L, errno);42 lua_pushinteger(L, en);
42 return 3;43 return 3;
43 }44 }
44}45}
src/llex.c+4−6
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: llex.c,v 2.17 2005/12/22 16:19:56 roberto Exp $2** $Id: llex.c,v 2.18 2006/01/23 20:06:19 roberto Exp $
3** Lexical Analyzer3** Lexical Analyzer
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -193,12 +193,10 @@ static void read_numeral (LexState *ls, SemInfo *seminfo) { · 187 unmodified lines
193 do {193 do {
194 save_and_next(ls);194 save_and_next(ls);
195 } while (isdigit(ls->current) || ls->current == '.');195 } while (isdigit(ls->current) || ls->current == '.');
196 if (check_next(ls, "Ee")) { /* `E'? */196 if (check_next(ls, "Ee")) /* `E'? */
197 check_next(ls, "+-"); /* optional exponent sign */197 check_next(ls, "+-"); /* optional exponent sign */
198 while (isdigit(ls->current)) {198 while (isalnum(ls->current) || ls->current == '_')
199 save_and_next(ls);199 save_and_next(ls);
200 }
201 }
202 save(ls, '\0');200 save(ls, '\0');
203 buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */201 buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */
204 if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) /* format error? */202 if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) /* format error? */
src/lobject.h+1−4
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lobject.h,v 2.19 2006/01/10 12:51:53 roberto Exp $2** $Id: lobject.h,v 2.20 2006/01/18 11:37:34 roberto Exp $
3** Type definitions for Lua objects3** Type definitions for Lua objects
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -119,9 +119,6 @@ typedef struct lua_TValue { · 113 unmodified lines
119#define setnvalue(obj,x) \119#define setnvalue(obj,x) \
120 { TValue *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; }120 { TValue *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; }
121 121
122#define chgnvalue(obj,x) \
123 check_exp(ttype(obj)==LUA_TNUMBER, (obj)->value.n=(x))
124
125#define setpvalue(obj,x) \122#define setpvalue(obj,x) \
126 { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; }123 { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; }
127 124
src/ltable.c+2−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: ltable.c,v 2.31 2006/01/10 13:13:06 roberto Exp $2** $Id: ltable.c,v 2.32 2006/01/18 11:49:02 roberto Exp $
3** Lua tables (hash)3** Lua tables (hash)
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -122,7 +122,7 @@ static int arrayindex (const TValue *key) { · 116 unmodified lines
122 lua_Number n = nvalue(key);122 lua_Number n = nvalue(key);
123 int k;123 int k;
124 lua_number2int(k, n);124 lua_number2int(k, n);
125 if (luai_numeq(cast_num(k), nvalue(key)))125 if (luai_numeq(cast_num(k), n))
126 return k;126 return k;
127 }127 }
128 return -1; /* `key' did not match some condition */128 return -1; /* `key' did not match some condition */
src/luaconf.h+3−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: luaconf.h,v 1.77 2005/12/27 17:12:00 roberto Exp $2** $Id: luaconf.h,v 1.79 2006/01/23 19:51:43 roberto Exp $
3** Configuration file for Lua3** Configuration file for Lua
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -488,6 +488,7 @@ · 482 unmodified lines
488** ===================================================================488** ===================================================================
489*/489*/
490 490
491#define LUA_NUMBER_DOUBLE
491#define LUA_NUMBER double492#define LUA_NUMBER double
492 493
493/*494/*
@@ -702,7 +703,7 @@ union luai_Cast { double l_d; long l_l; }; · 208 unmodified lines
702 703
703/*704/*
704@@ LUA_INTFRMLEN is the length modifier for integer conversions705@@ LUA_INTFRMLEN is the length modifier for integer conversions
705@* in 'string.fomat'.706@* in 'string.format'.
706@@ LUA_INTFRM_T is the integer type correspoding to the previous length707@@ LUA_INTFRM_T is the integer type correspoding to the previous length
707@* modifier.708@* modifier.
708** CHANGE them if your system supports long long or does not support long.709** CHANGE them if your system supports long long or does not support long.
src/lvm.c+5−3
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lvm.c,v 2.61 2006/01/10 12:50:00 roberto Exp $2** $Id: lvm.c,v 2.62 2006/01/23 19:51:43 roberto Exp $
3** Lua virtual machine3** Lua virtual machine
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -95,7 +95,8 @@ static void callTMres (lua_State *L, StkId res, const TValue *f, · 89 unmodified lines
95 95
96 96
97 97
98static void callTM (lua_State *L, const TValue *f, const TValue *p1, const TValue *p2, const TValue *p3) {98static void callTM (lua_State *L, const TValue *f, const TValue *p1,
99 const TValue *p2, const TValue *p3) {
99 setobj2s(L, L->top, f); /* push function */100 setobj2s(L, L->top, f); /* push function */
100 setobj2s(L, L->top+1, p1); /* 1st argument */101 setobj2s(L, L->top+1, p1); /* 1st argument */
101 setobj2s(L, L->top+2, p2); /* 2nd argument */102 setobj2s(L, L->top+2, p2); /* 2nd argument */
@@ -649,7 +650,8 @@ void luaV_execute (lua_State *L, int nexeccalls) { · 547 unmodified lines
649 lua_Number step = nvalue(ra+2);650 lua_Number step = nvalue(ra+2);
650 lua_Number idx = luai_numadd(nvalue(ra), step); /* increment index */651 lua_Number idx = luai_numadd(nvalue(ra), step); /* increment index */
651 lua_Number limit = nvalue(ra+1);652 lua_Number limit = nvalue(ra+1);
652 if (step > 0 ? luai_numle(idx, limit) : luai_numle(limit, idx)) {653 if (luai_numlt(0, step) ? luai_numle(idx, limit)
654 : luai_numle(limit, idx)) {
653 dojump(L, pc, GETARG_sBx(i)); /* jump back */655 dojump(L, pc, GETARG_sBx(i)); /* jump back */
654 setnvalue(ra, idx); /* update internal index... */656 setnvalue(ra, idx); /* update internal index... */
655 setnvalue(ra+3, idx); /* ...and external index */657 setnvalue(ra+3, idx); /* ...and external index */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t