Skip to content

Commit

Permalink
Update Lua version to 5.4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
randstr committed Aug 15, 2024
1 parent 7ce2abe commit 5a91b67
Show file tree
Hide file tree
Showing 33 changed files with 376 additions and 274 deletions.
2 changes: 1 addition & 1 deletion lua/README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

This is Lua 5.4.6, released on 02 May 2023.
This is Lua 5.4.7, released on 13 Jun 2024.

For installation instructions, license details, and
further information about Lua, see doc/readme.html.
Expand Down
Binary file added lua/doc/OSIApproved_100X125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions lua/doc/lua.css
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ table.book td.cover {

table.book img {
border: solid #000080 1px ;
border-radius: 2px ;
}

table.book span {
Expand Down
Binary file removed lua/doc/osi-certified-72x60.png
Binary file not shown.
48 changes: 25 additions & 23 deletions lua/doc/readme.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<BODY>

<H1>
<A HREF="http://www.lua.org/"><IMG SRC="logo.gif" ALT="Lua"></A>
<A HREF="https://www.lua.org/"><IMG SRC="logo.gif" ALT="Lua"></A>
Welcome to Lua 5.4
</H1>

Expand All @@ -49,37 +49,39 @@ <H2><A NAME="about">About Lua</A></H2>
<P>
Lua is a powerful, efficient, lightweight, embeddable scripting language
developed by a
<A HREF="http://www.lua.org/authors.html">team</A>
<A HREF="https://www.lua.org/authors.html">team</A>
at
<A HREF="http://www.puc-rio.br/">PUC-Rio</A>,
<A HREF="https://www.puc-rio.br/">PUC-Rio</A>,
the Pontifical Catholic University of Rio de Janeiro in Brazil.
Lua is
<A HREF="#license">free software</A>
used in
<A HREF="http://www.lua.org/uses.html">many products and projects</A>
<A HREF="https://www.lua.org/uses.html">many products and projects</A>
around the world.

<P>
Lua's
<A HREF="http://www.lua.org/">official web site</A>
<A HREF="https://www.lua.org/">official website</A>
provides complete information
about Lua,
including
an
<A HREF="http://www.lua.org/about.html">executive summary</A>
<A HREF="https://www.lua.org/about.html">executive summary</A>,
tips on
<A HREF="https://www.lua.org/start.html">getting started</A>,
and
updated
<A HREF="http://www.lua.org/docs.html">documentation</A>,
<A HREF="https://www.lua.org/docs.html">documentation</A>,
especially the
<A HREF="http://www.lua.org/manual/5.4/">reference manual</A>,
<A HREF="https://www.lua.org/manual/5.4/">reference manual</A>,
which may differ slightly from the
<A HREF="contents.html">local copy</A>
distributed in this package.

<H2><A NAME="install">Installing Lua</A></H2>
<P>
Lua is distributed in
<A HREF="http://www.lua.org/ftp/">source</A>
<A HREF="https://www.lua.org/ftp/">source</A>
form.
You need to build it before using it.
Building Lua should be straightforward
Expand All @@ -88,7 +90,7 @@ <H2><A NAME="install">Installing Lua</A></H2>
platforms that have an ANSI C compiler.
Lua also compiles unmodified as C++.
The instructions given below for building Lua are for Unix-like platforms,
such as Linux and Mac OS X.
such as Linux and macOS.
See also
<A HREF="#other">instructions for other systems</A>
and
Expand All @@ -97,7 +99,7 @@ <H2><A NAME="install">Installing Lua</A></H2>
<P>
If you don't have the time or the inclination to compile Lua yourself,
get a binary from
<A HREF="http://lua-users.org/wiki/LuaBinaries">LuaBinaries</A>.
<A HREF="https://luabinaries.sourceforge.net">LuaBinaries</A>.

<H3>Building Lua</H3>
<P>
Expand All @@ -107,7 +109,7 @@ <H3>Building Lua</H3>
<OL>
<LI>
Open a terminal window and move to
the top-level directory, which is named <TT>lua-5.4.6</TT>.
the top-level directory, which is named <TT>lua-5.4.7</TT>.
The <TT>Makefile</TT> there controls both the build process and the installation process.
<P>
<LI>
Expand Down Expand Up @@ -211,8 +213,8 @@ <H3><A NAME="customization">Customization</A></H3>
record the changes you've made.

<P>
On the other hand, if you need to customize some Lua features, you'll need
to edit <TT>src/luaconf.h</TT> before building and installing Lua.
On the other hand, if you need to customize some Lua features,
edit <TT>src/luaconf.h</TT> before building and installing Lua.
The edited file will be the one installed, and
it will be used by any Lua clients that you build, to ensure consistency.
Further customization is available to experts by editing the Lua sources.
Expand Down Expand Up @@ -241,7 +243,7 @@ <H3><A NAME="other">Building Lua on other systems</A></H3>
</DL>

<P>
To use Lua as a library in your own programs, you'll need to know how to
To use Lua as a library in your own programs, you need to know how to
create and use libraries with your compiler. Moreover, to dynamically load
C libraries for Lua, you'll need to know how to create dynamic libraries
and you'll need to make sure that the Lua API functions are accessible to
Expand Down Expand Up @@ -284,23 +286,23 @@ <H3>Main changes</H3>

<H2><A NAME="license">License</A></H2>
<P>
<A HREF="http://www.opensource.org/docs/definition.php">
<IMG SRC="osi-certified-72x60.png" ALIGN="right" ALT="[osi certified]" STYLE="padding-left: 30px ;">
<A HREF="https://opensource.org/osd">
<IMG SRC="OSIApproved_100X125.png" ALIGN="right" ALT="[Open Source Initiative Approved License]" STYLE="padding-left: 1em" WIDTH=50>
</A>
Lua is free software distributed under the terms of the
<A HREF="http://www.opensource.org/licenses/mit-license.html">MIT license</A>
<A HREF="https://opensource.org/license/mit">MIT license</A>
reproduced below;
it may be used for any purpose, including commercial purposes,
at absolutely no cost without having to ask us.

The only requirement is that if you do use Lua,
then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation.

For details, see
<A HREF="http://www.lua.org/license.html">this</A>.
For details, see the
<A HREF="https://www.lua.org/license.html">license page</A>.

<BLOCKQUOTE STYLE="padding-bottom: 0em">
Copyright &copy; 1994&ndash;2023 Lua.org, PUC-Rio.
Copyright &copy; 1994&ndash;2024 Lua.org, PUC-Rio.

<P>
Permission is hereby granted, free of charge, to any person obtaining a copy
Expand All @@ -327,10 +329,10 @@ <H2><A NAME="license">License</A></H2>

<P CLASS="footer">
Last update:
Tue May 2 20:08:55 UTC 2023
Wed May 8 21:56:16 UTC 2024
</P>
<!--
Last change: revised for Lua 5.4.6
Last change: revised for Lua 5.4.7
-->

</BODY>
Expand Down
4 changes: 2 additions & 2 deletions lua/src/lapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,9 @@ LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) {
o = index2value(L, idx); /* previous call may reallocate the stack */
}
if (len != NULL)
*len = vslen(o);
*len = tsslen(tsvalue(o));
lua_unlock(L);
return svalue(o);
return getstr(tsvalue(o));
}


Expand Down
28 changes: 21 additions & 7 deletions lua/src/lauxlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ static int pushglobalfuncname (lua_State *L, lua_Debug *ar) {
int top = lua_gettop(L);
lua_getinfo(L, "f", ar); /* push function */
lua_getfield(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE);
luaL_checkstack(L, 6, "not enough stack"); /* slots for 'findfield' */
if (findfield(L, top + 1, 2)) {
const char *name = lua_tostring(L, -1);
if (strncmp(name, LUA_GNAME ".", 3) == 0) { /* name start with '_G.'? */
Expand Down Expand Up @@ -249,11 +250,13 @@ LUALIB_API int luaL_fileresult (lua_State *L, int stat, const char *fname) {
return 1;
}
else {
const char *msg;
luaL_pushfail(L);
msg = (en != 0) ? strerror(en) : "(no extra info)";
if (fname)
lua_pushfstring(L, "%s: %s", fname, strerror(en));
lua_pushfstring(L, "%s: %s", fname, msg);
else
lua_pushstring(L, strerror(en));
lua_pushstring(L, msg);
lua_pushinteger(L, en);
return 3;
}
Expand Down Expand Up @@ -732,9 +735,12 @@ static const char *getF (lua_State *L, void *ud, size_t *size) {


static int errfile (lua_State *L, const char *what, int fnameindex) {
const char *serr = strerror(errno);
int err = errno;
const char *filename = lua_tostring(L, fnameindex) + 1;
lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr);
if (err != 0)
lua_pushfstring(L, "cannot %s %s: %s", what, filename, strerror(err));
else
lua_pushfstring(L, "cannot %s %s", what, filename);
lua_remove(L, fnameindex);
return LUA_ERRFILE;
}
Expand Down Expand Up @@ -787,6 +793,7 @@ LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename,
}
else {
lua_pushfstring(L, "@%s", filename);
errno = 0;
lf.f = fopen(filename, "r");
if (lf.f == NULL) return errfile(L, "open", fnameindex);
}
Expand All @@ -796,13 +803,15 @@ LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename,
if (c == LUA_SIGNATURE[0]) { /* binary file? */
lf.n = 0; /* remove possible newline */
if (filename) { /* "real" file? */
errno = 0;
lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */
if (lf.f == NULL) return errfile(L, "reopen", fnameindex);
skipcomment(lf.f, &c); /* re-read initial portion */
}
}
if (c != EOF)
lf.buff[lf.n++] = c; /* 'c' is the first character of the stream */
errno = 0;
status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode);
readstatus = ferror(lf.f);
if (filename) fclose(lf.f); /* close file (even in case of errors) */
Expand Down Expand Up @@ -933,7 +942,7 @@ LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) {
LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
luaL_checkstack(L, nup, "too many upvalues");
for (; l->name != NULL; l++) { /* fill the table with given functions */
if (l->func == NULL) /* place holder? */
if (l->func == NULL) /* placeholder? */
lua_pushboolean(L, 0);
else {
int i;
Expand Down Expand Up @@ -1025,9 +1034,14 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
}


/*
** Standard panic funcion just prints an error message. The test
** with 'lua_type' avoids possible memory errors in 'lua_tostring'.
*/
static int panic (lua_State *L) {
const char *msg = lua_tostring(L, -1);
if (msg == NULL) msg = "error object is not a string";
const char *msg = (lua_type(L, -1) == LUA_TSTRING)
? lua_tostring(L, -1)
: "error object is not a string";
lua_writestringerror("PANIC: unprotected error in call to Lua API (%s)\n",
msg);
return 0; /* return to Lua to abort */
Expand Down
Loading

0 comments on commit 5a91b67

Please sign in to comment.