mirror of
https://github.com/lua/lua
synced 2024-11-22 04:41:23 +03:00
Towards Lua 5.5
This commit is contained in:
parent
7d6a97e42b
commit
540d805226
8
lua.h
8
lua.h
@ -17,11 +17,11 @@
|
||||
|
||||
|
||||
#define LUA_VERSION_MAJOR "5"
|
||||
#define LUA_VERSION_MINOR "4"
|
||||
#define LUA_VERSION_RELEASE "5"
|
||||
#define LUA_VERSION_MINOR "5"
|
||||
#define LUA_VERSION_RELEASE "0"
|
||||
|
||||
#define LUA_VERSION_NUM 504
|
||||
#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 5)
|
||||
#define LUA_VERSION_NUM 505
|
||||
#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 0)
|
||||
|
||||
#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
|
||||
#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
|
||||
|
123
manual/manual.of
123
manual/manual.of
@ -1586,7 +1586,8 @@ Each variable name may be postfixed by an attribute
|
||||
@producname{attrib}@producbody{@bnfopt{@bnfter{<} @bnfNter{Name} @bnfter{>}}}
|
||||
}
|
||||
There are two possible attributes:
|
||||
@id{const}, which declares a @x{constant variable},
|
||||
@id{const}, which declares a @emph{constant} or @emph{read-only} variable,
|
||||
@index{constant variable}
|
||||
that is, a variable that cannot be assigned to
|
||||
after its initialization;
|
||||
and @id{close}, which declares a to-be-closed variable @see{to-be-closed}.
|
||||
@ -9118,7 +9119,7 @@ is a more portable solution.
|
||||
@simplesect{
|
||||
|
||||
Here we list the incompatibilities that you may find when moving a program
|
||||
from @N{Lua 5.3} to @N{Lua 5.4}.
|
||||
from @N{Lua 5.4} to @N{Lua 5.5}.
|
||||
|
||||
You can avoid some incompatibilities by compiling Lua with
|
||||
appropriate options (see file @id{luaconf.h}).
|
||||
@ -9155,51 +9156,6 @@ change between versions.
|
||||
@itemize{
|
||||
|
||||
@item{
|
||||
The coercion of strings to numbers in
|
||||
arithmetic and bitwise operations
|
||||
has been removed from the core language.
|
||||
The string library does a similar job
|
||||
for arithmetic (but not for bitwise) operations
|
||||
using the string metamethods.
|
||||
However, unlike in previous versions,
|
||||
the new implementation preserves the implicit type of the numeral
|
||||
in the string.
|
||||
For instance, the result of @T{"1" + "2"} now is an integer,
|
||||
not a float.
|
||||
}
|
||||
|
||||
@item{
|
||||
Literal decimal integer constants that overflow are read as floats,
|
||||
instead of wrapping around.
|
||||
You can use hexadecimal notation for such constants if you
|
||||
want the old behavior
|
||||
(reading them as integers with wrap around).
|
||||
}
|
||||
|
||||
@item{
|
||||
The use of the @idx{__lt} metamethod to emulate @idx{__le}
|
||||
has been removed.
|
||||
When needed, this metamethod must be explicitly defined.
|
||||
}
|
||||
|
||||
@item{
|
||||
The semantics of the numerical @Rw{for} loop
|
||||
over integers changed in some details.
|
||||
In particular, the control variable never wraps around.
|
||||
}
|
||||
|
||||
@item{
|
||||
A label for a @Rw{goto} cannot be declared where a label with the same
|
||||
name is visible, even if this other label is declared in an enclosing
|
||||
block.
|
||||
}
|
||||
|
||||
@item{
|
||||
When finalizing an object,
|
||||
Lua does not ignore @idx{__gc} metamethods that are not functions.
|
||||
Any value will be called, if present.
|
||||
(Non-callable values will generate a warning,
|
||||
like any other error when calling a finalizer.)
|
||||
}
|
||||
|
||||
}
|
||||
@ -9210,39 +9166,6 @@ like any other error when calling a finalizer.)
|
||||
@itemize{
|
||||
|
||||
@item{
|
||||
The function @Lid{print} does not call @Lid{tostring}
|
||||
to format its arguments;
|
||||
instead, it has this functionality hardwired.
|
||||
You should use @idx{__tostring} to modify how values are printed.
|
||||
}
|
||||
|
||||
@item{
|
||||
The pseudo-random number generator used by the function @Lid{math.random}
|
||||
now starts with a somewhat random seed.
|
||||
Moreover, it uses a different algorithm.
|
||||
}
|
||||
|
||||
@item{
|
||||
By default, the decoding functions in the @Lid{utf8} library
|
||||
do not accept surrogates as valid code points.
|
||||
An extra parameter in these functions makes them more permissive.
|
||||
}
|
||||
|
||||
@item{
|
||||
The options @St{setpause} and @St{setstepmul}
|
||||
of the function @Lid{collectgarbage} are deprecated.
|
||||
You should use the new option @St{incremental} to set them.
|
||||
}
|
||||
|
||||
@item{
|
||||
The function @Lid{io.lines} now returns four values,
|
||||
instead of just one.
|
||||
That can be a problem when it is used as the sole
|
||||
argument to another function that has optional parameters,
|
||||
such as in @T{load(io.lines(filename, "L"))}.
|
||||
To fix that issue,
|
||||
you can wrap the call into parentheses,
|
||||
to adjust its number of results to one.
|
||||
}
|
||||
|
||||
}
|
||||
@ -9254,46 +9177,6 @@ to adjust its number of results to one.
|
||||
@itemize{
|
||||
|
||||
@item{
|
||||
Full userdata now has an arbitrary number of associated user values.
|
||||
Therefore, the functions @id{lua_newuserdata},
|
||||
@id{lua_setuservalue}, and @id{lua_getuservalue} were
|
||||
replaced by @Lid{lua_newuserdatauv},
|
||||
@Lid{lua_setiuservalue}, and @Lid{lua_getiuservalue},
|
||||
which have an extra argument.
|
||||
|
||||
For compatibility, the old names still work as macros assuming
|
||||
one single user value.
|
||||
Note, however, that userdata with zero user values
|
||||
are more efficient memory-wise.
|
||||
}
|
||||
|
||||
@item{
|
||||
The function @Lid{lua_resume} has an extra parameter.
|
||||
This out parameter returns the number of values on
|
||||
the top of the stack that were yielded or returned by the coroutine.
|
||||
(In previous versions,
|
||||
those values were the entire stack.)
|
||||
}
|
||||
|
||||
@item{
|
||||
The function @Lid{lua_version} returns the version number,
|
||||
instead of an address of the version number.
|
||||
The Lua core should work correctly with libraries using their
|
||||
own static copies of the same core,
|
||||
so there is no need to check whether they are using the same
|
||||
address space.
|
||||
}
|
||||
|
||||
@item{
|
||||
The constant @id{LUA_ERRGCMM} was removed.
|
||||
Errors in finalizers are never propagated;
|
||||
instead, they generate a warning.
|
||||
}
|
||||
|
||||
@item{
|
||||
The options @idx{LUA_GCSETPAUSE} and @idx{LUA_GCSETSTEPMUL}
|
||||
of the function @Lid{lua_gc} are deprecated.
|
||||
You should use the new option @id{LUA_GCINC} to set them.
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- See Copyright Notice at the end of this file
|
||||
|
||||
|
||||
local version = "Lua 5.4"
|
||||
local version = "Lua 5.5"
|
||||
if _VERSION ~= version then
|
||||
io.stderr:write("This test suite is for ", version,
|
||||
", not for ", _VERSION, "\nExiting tests")
|
||||
|
@ -448,7 +448,7 @@ print("testing binary chunks")
|
||||
do
|
||||
local header = string.pack("c4BBc6BBB",
|
||||
"\27Lua", -- signature
|
||||
0x54, -- version 5.4 (0x54)
|
||||
0x55, -- version 5.5 (0x55)
|
||||
0, -- format
|
||||
"\x19\x93\r\n\x1a\n", -- data
|
||||
4, -- size of instruction
|
||||
|
@ -134,7 +134,7 @@ RUN('env LUA_INIT= LUA_PATH=x lua %s > %s', prog, out)
|
||||
checkout("x\n")
|
||||
|
||||
-- test LUA_PATH_version
|
||||
RUN('env LUA_INIT= LUA_PATH_5_4=y LUA_PATH=x lua %s > %s', prog, out)
|
||||
RUN('env LUA_INIT= LUA_PATH_5_5=y LUA_PATH=x lua %s > %s', prog, out)
|
||||
checkout("y\n")
|
||||
|
||||
-- test LUA_CPATH
|
||||
@ -143,7 +143,7 @@ RUN('env LUA_INIT= LUA_CPATH=xuxu lua %s > %s', prog, out)
|
||||
checkout("xuxu\n")
|
||||
|
||||
-- test LUA_CPATH_version
|
||||
RUN('env LUA_INIT= LUA_CPATH_5_4=yacc LUA_CPATH=x lua %s > %s', prog, out)
|
||||
RUN('env LUA_INIT= LUA_CPATH_5_5=yacc LUA_CPATH=x lua %s > %s', prog, out)
|
||||
checkout("yacc\n")
|
||||
|
||||
-- test LUA_INIT (and its access to 'arg' table)
|
||||
@ -153,7 +153,7 @@ checkout("3.2\n")
|
||||
|
||||
-- test LUA_INIT_version
|
||||
prepfile("print(X)")
|
||||
RUN('env LUA_INIT_5_4="X=10" LUA_INIT="X=3" lua %s > %s', prog, out)
|
||||
RUN('env LUA_INIT_5_5="X=10" LUA_INIT="X=3" lua %s > %s', prog, out)
|
||||
checkout("10\n")
|
||||
|
||||
-- test LUA_INIT for files
|
||||
|
Loading…
Reference in New Issue
Block a user