Unified · Split
| @@ -1,4 +1,4 @@ | ||
| 1 | −This is Lua 5.1. | |
| 1 | +HISTORY for Lua 5.1 | |
| 2 | 2 | |
| 3 | 3 | * Changes from version 5.0 to 5.1 |
| 4 | 4 | ------------------------------- |
| @@ -14,6 +14,7 @@ This is Lua 5.1. · 9 unmodified lines | ||
| 14 | 14 | API: |
| 15 | 15 | + new functions: lua_createtable, lua_get(set)field, lua_push(to)integer. |
| 16 | 16 | + user supplies memory allocator (lua_open becomes lua_newstate). |
| 17 | + + luaopen_* functionst be called through Lua. | |
| 17 | 18 | Implementation: |
| 18 | 19 | + new configuration scheme via luaconf.h. |
| 19 | 20 | + incremental garbage collection. |
| @@ -1,4 +1,4 @@ | ||
| 1 | −This is Lua 5.1. | |
| 1 | +INSTALL for Lua 5.1 | |
| 2 | 2 | |
| 3 | 3 | * Building Lua |
| 4 | 4 | ------------ |
| @@ -8,7 +8,7 @@ This is Lua 5.1. · 3 unmodified lines | ||
| 8 | 8 | Building Lua on Unix systems should be very easy. First do "make" and |
| 9 | 9 | see if your platform is listed. If so, just do "make xxx", where xxx |
| 10 | 10 | is your platform name. The platforms currently supported are: |
| 11 | − ansi bsd generic linux macosx mingw posix | |
| 11 | + ansi bsd generic linux macosx mingw posix solaris | |
| 12 | 12 | |
| 13 | 13 | See below for customization instructions and for instructions on how |
| 14 | 14 | to build with other Windows compilers. |
| @@ -1,4 +1,4 @@ | ||
| 1 | −MANIFEST contents of Lua 5.1 distribution on Wed Jan 11 22:50:45 BRST 2006 | |
| 1 | +MANIFEST contents of Lua 5.1 distribution on Tue Jan 24 16:12:03 BRST 2006 | |
| 2 | 2 | lua-5.1 |
| 3 | 3 | lua-5.1/COPYRIGHT |
| 4 | 4 | lua-5.1/doc |
| @@ -16,6 +16,8 @@ INSTALL_BIN= $(INSTALL_TOP)/bin · 15 unmodified lines | ||
| 16 | 16 | INSTALL_INC= $(INSTALL_TOP)/include |
| 17 | 17 | INSTALL_LIB= $(INSTALL_TOP)/lib |
| 18 | 18 | INSTALL_MAN= $(INSTALL_TOP)/man/man1 |
| 19 | +INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V | |
| 20 | +INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V | |
| 19 | 21 | |
| 20 | 22 | # How to install. You may prefer "install" instead of "cp" if you have it. |
| 21 | 23 | # To remove debug information from binaries, use "install -s" in INSTALL_EXEC. |
| @@ -28,7 +30,7 @@ INSTALL_DATA= cp · 6 unmodified lines | ||
| 28 | 30 | # == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE ========= |
| 29 | 31 | |
| 30 | 32 | # Convenience platforms targets. |
| 31 | −PLATS= ansi bsd generic linux macosx mingw posix | |
| 33 | +PLATS= ansi bsd generic linux macosx mingw posix solaris | |
| 32 | 34 | |
| 33 | 35 | # What to install. |
| 34 | 36 | TO_BIN= lua luac |
| @@ -39,7 +41,7 @@ TO_MAN= lua.1 luac.1 · 4 unmodified lines | ||
| 39 | 41 | # Lua version. Currently used only for messages. |
| 40 | 42 | V= 5.1 |
| 41 | 43 | |
| 42 | −all: $(PLAT) | |
| 44 | +all: $(PLAT) | |
| 43 | 45 | |
| 44 | 46 | $(PLATS) clean: |
| 45 | 47 | cd src; $(MAKE) $@ |
| @@ -47,8 +49,8 @@ $(PLATS) clean: · 1 unmodified line | ||
| 47 | 49 | test: all |
| 48 | 50 | src/lua test/hello.lua |
| 49 | 51 | |
| 50 | −install: all | |
| 51 | − cd src; mkdir -p $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) | |
| 52 | +install: | |
| 53 | + cd src; mkdir -p $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD) | |
| 52 | 54 | cd src; $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN) |
| 53 | 55 | cd src; $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) |
| 54 | 56 | cd src; $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) |
| @@ -77,6 +79,9 @@ echo: · 22 unmodified lines | ||
| 77 | 79 | @echo "INSTALL_MAN = $(INSTALL_MAN)" |
| 78 | 80 | @echo "INSTALL_EXEC = $(INSTALL_EXEC)" |
| 79 | 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 | 85 | @echo "" |
| 81 | 86 | @echo "See also src/luaconf.h ." |
| 82 | 87 | @echo "" |
| @@ -1,4 +1,6 @@ | ||
| 1 | −This is Lua 5.1. | |
| 1 | +README for Lua 5.1 | |
| 2 | + | |
| 3 | +See INSTALL for installation instructions. | |
| 2 | 4 | See HISTORY for a summary of changes since the last released version. |
| 3 | 5 | |
| 4 | 6 | * What is Lua? |
| @@ -1174,7 +1174,7 @@ while all of them share the same <code>x</code>. · 1173 unmodified lines | ||
| 1174 | 1174 | |
| 1175 | 1175 | <p>Because Lua is an embedded extension language, |
| 1176 | 1176 | all Lua actions start from C code in the host program |
| 1177 | −calling a function from the Lua library (see <a href="#lua_pcall"></a>). | |
| 1177 | +calling a function from the Lua library (see <a href="#lua_pcall"><code>lua_pcall</code></a>). | |
| 1178 | 1178 | Whenever an error occurs during Lua compilation or execution, |
| 1179 | 1179 | control returns to C, |
| 1180 | 1180 | which can take appropriate measures |
| @@ -1509,11 +1509,11 @@ called when Lua calls a value. · 328 unmodified lines | ||
| 1509 | 1509 | <pre> |
| 1510 | 1510 | function function_event (func, ...) |
| 1511 | 1511 | if type(func) == "function" then |
| 1512 | − return func(unpack(arg)) -- primitive call | |
| 1512 | + return func(...) -- primitive call | |
| 1513 | 1513 | else |
| 1514 | 1514 | local h = metatable(func).__call |
| 1515 | 1515 | if h then |
| 1516 | − return h(func, unpack(arg)) | |
| 1516 | + return h(func, ...) | |
| 1517 | 1517 | else |
| 1518 | 1518 | error("...") |
| 1519 | 1519 | end |
| @@ -1553,7 +1553,7 @@ all accesses to global variables within that function (see <a href="#variables"> · 33 unmodified lines | ||
| 1553 | 1553 | They are used as the default environment for other Lua functions |
| 1554 | 1554 | created by that function. |
| 1555 | 1555 | |
| 1556 | −<p>You can change the environment of a Lua function of the | |
| 1556 | +<p>You can change the environment of a Lua function or the | |
| 1557 | 1557 | running thread calling <a href="#pdf-setfenv"><code>setfenv</code></a>. |
| 1558 | 1558 | You can get the environment of a Lua function or the running thread |
| 1559 | 1559 | calling <a href="#pdf-getfenv"><code>getfenv</code></a>. |
| @@ -1565,8 +1565,8 @@ use the C API. · 5 unmodified lines | ||
| 1565 | 1565 | |
| 1566 | 1566 | <p>Lua performs automatic memory management. |
| 1567 | 1567 | That means that |
| 1568 | −you do not have to worry about allocating memory for new objects | |
| 1569 | −not about freeing it when the objects are no longer needed. | |
| 1568 | +you do not have to worry neither about allocating memory for new objects | |
| 1569 | +nor about freeing it when the objects are no longer needed. | |
| 1570 | 1570 | Lua manages memory automatically by running |
| 1571 | 1571 | a <em>garbage collector</em> from time to time |
| 1572 | 1572 | to collect all <em>dead objects</em> |
| @@ -2821,7 +2821,7 @@ onto the stack. · 1248 unmodified lines | ||
| 2821 | 2821 | Lua makes (or reuses) an internal copy of the given string, |
| 2822 | 2822 | so the memory at <code>s</code> can be freed or reused immediately after |
| 2823 | 2823 | the function returns. |
| 2824 | −The string cannot embedded zeros; | |
| 2824 | +The string cannot contain embedded zeros; | |
| 2825 | 2825 | it is assumed to end at the first zero. |
| 2826 | 2826 | |
| 2827 | 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 | 3610 | <p>Sets the value of a local variable of a given activation record. |
| 3611 | 3611 | Parameters <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 | 3613 | <a href="#lua_setlocal"><code>lua_setlocal</code></a> assigns the value at the top of the stack |
| 3614 | 3614 | to the variable and returns its name. |
| 3615 | 3615 | It also pops the value from the stack. |
| @@ -3627,7 +3627,7 @@ the number of active local variables. · 11 unmodified lines | ||
| 3627 | 3627 | |
| 3628 | 3628 | <p>Sets the value of a closure's upvalue. |
| 3629 | 3629 | Parameters <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>). | |
| 3631 | 3631 | It assigns the value at the top of the stack |
| 3632 | 3632 | to the upvalue and returns its name. |
| 3633 | 3633 | It 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 | 3995 | </pre> |
| 3996 | 3996 | |
| 3997 | 3997 | |
| 3998 | −<p>Creates a copy of string <code>s</code> by replacing any occurrence | |
| 3998 | +<p>Creates a copy of string <code>s</code> by replacing | |
| 3999 | 3999 | any occurrence of the string <code>p</code> |
| 4000 | −wth the string <code>r</code>. | |
| 4000 | +with the string <code>r</code>. | |
| 4001 | 4001 | Pushes the resulting string on the stack and returns it. |
| 4002 | 4002 | |
| 4003 | 4003 | <p><a name="luaL_loadbuffer"></a> |
| @@ -5302,6 +5302,8 @@ of table <code>t</code>. · 1298 unmodified lines | ||
| 5302 | 5302 | |
| 5303 | 5303 | <p>Returns the largest positive numerical index of the given table, |
| 5304 | 5304 | or zero if the table has no positive numerical indices. |
| 5305 | +(To do its job this function does a linear traversal of | |
| 5306 | +the whole table.) | |
| 5305 | 5307 | |
| 5306 | 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 | 6079 | <p><h3>Changes in the API</h3> |
| 6078 | 6080 | <ul> |
| 6079 | −<li> | |
| 6081 | + | |
| 6082 | +<p><li> | |
| 6083 | +The <code>luaopen_*</code> functions (to open libraries) | |
| 6084 | +cannot be called directly, | |
| 6085 | +like a regular C function. | |
| 6086 | +They must be called through Lua, | |
| 6087 | +like a Lua function. | |
| 6088 | + | |
| 6089 | +<p><li> | |
| 6080 | 6090 | Function <code>lua_open</code> was replaced by <a href="#lua_newstate"><code>lua_newstate</code></a> to |
| 6081 | 6091 | allow the user to set a memory allocation function. |
| 6082 | 6092 | You can use <a href="#luaL_newstate"><code>luaL_newstate</code></a> from the standard library to |
| @@ -1,13 +1,16 @@ | ||
| 1 | 1 | # lua.pc -- pkg-config data for Lua |
| 2 | 2 | |
| 3 | 3 | # vars from install Makefile |
| 4 | −# grep ^INSTALL_...= ../Makefile | |
| 4 | +# grep '^INSTALL_.*=' ../Makefile | |
| 5 | 5 | INSTALL_TOP= /usr/local |
| 6 | 6 | INSTALL_BIN= $(INSTALL_TOP)/bin |
| 7 | 7 | INSTALL_INC= $(INSTALL_TOP)/include |
| 8 | 8 | INSTALL_LIB= $(INSTALL_TOP)/lib |
| 9 | 9 | INSTALL_MAN= $(INSTALL_TOP)/man/man1 |
| 10 | −# grep ^V= ../Makefile | |
| 10 | +INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V | |
| 11 | +INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V | |
| 12 | + | |
| 13 | +# grep '^V=' ../Makefile | |
| 11 | 14 | V= 5.1 |
| 12 | 15 | |
| 13 | 16 | prefix=${INSTALL_TOP} |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | # makefile for building Lua |
| 2 | −# see INSTALL for installation instructions | |
| 2 | +# see ../INSTALL for installation instructions | |
| 3 | 3 | # see ../Makefile and luaconf.h for further customization |
| 4 | 4 | |
| 5 | 5 | # == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= |
| @@ -20,7 +20,7 @@ MYLIBS= · 14 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | # == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE ========= |
| 22 | 22 | |
| 23 | −PLATS= ansi bsd generic linux macosx mingw posix | |
| 23 | +PLATS= ansi bsd generic linux macosx mingw posix solaris | |
| 24 | 24 | |
| 25 | 25 | LUA_A= liblua.a |
| 26 | 26 | CORE_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 | 74 | @echo "MYLDFLAGS = $(MYLDFLAGS)" |
| 75 | 75 | @echo "MYLIBS = $(MYLIBS)" |
| 76 | 76 | |
| 77 | −# convenience targets for usual platforms | |
| 77 | +# convenience targets for popular platforms | |
| 78 | 78 | |
| 79 | 79 | none: |
| 80 | 80 | @echo "Please choose a platform: $(PLATS)" |
| @@ -93,15 +93,21 @@ linux: · 12 unmodified lines | ||
| 93 | 93 | |
| 94 | 94 | macosx: |
| 95 | 95 | $(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 | |
| 97 | 99 | mingw: |
| 98 | 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 | 102 | "MYCFLAGS=-DLUA_BUILD_AS_DLL" "MYLIBS=" "MYLDFLAGS=-s" lua.exe |
| 101 | 103 | |
| 102 | 104 | posix: |
| 103 | 105 | $(MAKE) all MYCFLAGS=-DLUA_USE_POSIX |
| 104 | 106 | |
| 107 | +solaris: | |
| 108 | + $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" | |
| 109 | + | |
| 110 | + | |
| 105 | 111 | # DO NOT DELETE |
| 106 | 112 | |
| 107 | 113 | lapi.o: lapi.c lua.h luaconf.h lapi.h lobject.h llimits.h ldebug.h \ |
| @@ -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 | 3 | ** Auxiliary functions for building Lua libraries |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -295,23 +295,33 @@ static void getsizes (lua_State *L) { · 289 unmodified lines | ||
| 295 | 295 | |
| 296 | 296 | LUALIB_API void luaL_setn (lua_State *L, int t, int n) { |
| 297 | 297 | t = abs_index(L, t); |
| 298 | − getsizes(L); | |
| 299 | − lua_pushvalue(L, t); | |
| 300 | − lua_pushinteger(L, n); | |
| 301 | − lua_rawset(L, -3); /* sizes[t] = n */ | |
| 302 | − lua_pop(L, 1); /* remove `sizes' */ | |
| 298 | + lua_pushliteral(L, "n"); | |
| 299 | + lua_rawget(L, t); | |
| 300 | + if (checkint(L, 1) >= 0) { /* is there a numeric field `n'? */ | |
| 301 | + lua_pushliteral(L, "n"); /* use it */ | |
| 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 | |
| 306 | 315 | LUALIB_API int luaL_getn (lua_State *L, int t) { |
| 307 | 316 | int n; |
| 308 | 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 | 322 | lua_pushvalue(L, t); |
| 311 | 323 | lua_rawget(L, -2); |
| 312 | 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 | 325 | return (int)lua_objlen(L, t); |
| 316 | 326 | } |
| 317 | 327 | |
| @@ -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 | 3 | ** Basic library |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -201,7 +201,7 @@ static int luaB_collectgarbage (lua_State *L) { · 195 unmodified lines | ||
| 201 | 201 | switch (optsnum[o]) { |
| 202 | 202 | case LUA_GCCOUNT: { |
| 203 | 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 | 205 | return 1; |
| 206 | 206 | } |
| 207 | 207 | case LUA_GCSTEP: { |
| @@ -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 | 3 | ** Standard I/O (and system) library |
| 4 | 4 | ** 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 | |
| 30 | 30 | static int pushresult (lua_State *L, int i, const char *filename) { |
| 31 | + int en = errno; /* calls to Lua API may change this value */ | |
| 31 | 32 | if (i) { |
| 32 | 33 | lua_pushboolean(L, 1); |
| 33 | 34 | return 1; |
| @@ -35,10 +36,10 @@ static int pushresult (lua_State *L, int i, const char *filename) { · 1 unmodified line | ||
| 35 | 36 | else { |
| 36 | 37 | lua_pushnil(L); |
| 37 | 38 | if (filename) |
| 38 | − lua_pushfstring(L, "%s: %s", filename, strerror(errno)); | |
| 39 | + lua_pushfstring(L, "%s: %s", filename, strerror(en)); | |
| 39 | 40 | else |
| 40 | − lua_pushfstring(L, "%s", strerror(errno)); | |
| 41 | − lua_pushinteger(L, errno); | |
| 41 | + lua_pushfstring(L, "%s", strerror(en)); | |
| 42 | + lua_pushinteger(L, en); | |
| 42 | 43 | return 3; |
| 43 | 44 | } |
| 44 | 45 | } |
| @@ -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 | 3 | ** Lexical Analyzer |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -193,12 +193,10 @@ static void read_numeral (LexState *ls, SemInfo *seminfo) { · 187 unmodified lines | ||
| 193 | 193 | do { |
| 194 | 194 | save_and_next(ls); |
| 195 | 195 | } while (isdigit(ls->current) || ls->current == '.'); |
| 196 | − if (check_next(ls, "Ee")) { /* `E'? */ | |
| 196 | + if (check_next(ls, "Ee")) /* `E'? */ | |
| 197 | 197 | check_next(ls, "+-"); /* optional exponent sign */ |
| 198 | − while (isdigit(ls->current)) { | |
| 199 | − save_and_next(ls); | |
| 200 | − } | |
| 201 | − } | |
| 198 | + while (isalnum(ls->current) || ls->current == '_') | |
| 199 | + save_and_next(ls); | |
| 202 | 200 | save(ls, '\0'); |
| 203 | 201 | buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */ |
| 204 | 202 | if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) /* format error? */ |
| @@ -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 | 3 | ** Type definitions for Lua objects |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -119,9 +119,6 @@ typedef struct lua_TValue { · 113 unmodified lines | ||
| 119 | 119 | #define setnvalue(obj,x) \ |
| 120 | 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 | 122 | #define setpvalue(obj,x) \ |
| 126 | 123 | { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; } |
| 127 | 124 | |
| @@ -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 | 3 | ** Lua tables (hash) |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -122,7 +122,7 @@ static int arrayindex (const TValue *key) { · 116 unmodified lines | ||
| 122 | 122 | lua_Number n = nvalue(key); |
| 123 | 123 | int k; |
| 124 | 124 | lua_number2int(k, n); |
| 125 | − if (luai_numeq(cast_num(k), nvalue(key))) | |
| 125 | + if (luai_numeq(cast_num(k), n)) | |
| 126 | 126 | return k; |
| 127 | 127 | } |
| 128 | 128 | return -1; /* `key' did not match some condition */ |
| @@ -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 | 3 | ** Configuration file for Lua |
| 4 | 4 | ** 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 | 492 | #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 | 705 | @@ LUA_INTFRMLEN is the length modifier for integer conversions |
| 705 | −@* in 'string.fomat'. | |
| 706 | +@* in 'string.format'. | |
| 706 | 707 | @@ LUA_INTFRM_T is the integer type correspoding to the previous length |
| 707 | 708 | @* modifier. |
| 708 | 709 | ** CHANGE them if your system supports long long or does not support long. |
| @@ -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 | 3 | ** Lua virtual machine |
| 4 | 4 | ** 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 | |
| 98 | −static void callTM (lua_State *L, const TValue *f, const TValue *p1, const TValue *p2, const TValue *p3) { | |
| 98 | +static void callTM (lua_State *L, const TValue *f, const TValue *p1, | |
| 99 | + const TValue *p2, const TValue *p3) { | |
| 99 | 100 | setobj2s(L, L->top, f); /* push function */ |
| 100 | 101 | setobj2s(L, L->top+1, p1); /* 1st argument */ |
| 101 | 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 | 650 | lua_Number step = nvalue(ra+2); |
| 650 | 651 | lua_Number idx = luai_numadd(nvalue(ra), step); /* increment index */ |
| 651 | 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 | 655 | dojump(L, pc, GETARG_sBx(i)); /* jump back */ |
| 654 | 656 | setnvalue(ra, idx); /* update internal index... */ |
| 655 | 657 | setnvalue(ra+3, idx); /* ...and external index */ |