Update embedded Lua to 5.4.6

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2023-05-14 09:10:34 +02:00
parent b847da4f8b
commit d6695ebd42
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD
7 changed files with 18 additions and 32 deletions

View File

@ -76,7 +76,7 @@ static int luaB_auxwrap (lua_State *L) {
if (l_unlikely(r < 0)) { /* error? */
int stat = lua_status(co);
if (stat != LUA_OK && stat != LUA_YIELD) { /* error in the coroutine? */
stat = lua_resetthread(co, L); /* close its tbc variables */
stat = lua_closethread(co, L); /* close its tbc variables */
lua_assert(stat != LUA_OK);
lua_xmove(co, L, 1); /* move error message to the caller */
}
@ -172,7 +172,7 @@ static int luaB_close (lua_State *L) {
int status = auxstatus(L, co);
switch (status) {
case COS_DEAD: case COS_YIELD: {
status = lua_resetthread(co, L);
status = lua_closethread(co, L);
if (status == LUA_OK) {
lua_pushboolean(L, 1);
return 1;

View File

@ -50,9 +50,6 @@ static const luaL_Reg loadedlibs[] = {
{LUA_MATHLIBNAME, luaopen_math},
{LUA_UTF8LIBNAME, luaopen_utf8},
{LUA_DBLIBNAME, luaopen_debug},
/****** Pi-hole modification ******/
{LUA_PIHOLELIBNAME, luaopen_pihole},
/**********************************/
{NULL, NULL}
};

View File

@ -339,7 +339,7 @@ int luaE_resetthread (lua_State *L, int status) {
}
LUA_API int lua_resetthread (lua_State *L, lua_State *from) {
LUA_API int lua_closethread (lua_State *L, lua_State *from) {
int status;
lua_lock(L);
L->nCcalls = (from) ? getCcalls(from) : 0;
@ -349,6 +349,14 @@ LUA_API int lua_resetthread (lua_State *L, lua_State *from) {
}
/*
** Deprecated! Use 'lua_closethread' instead.
*/
LUA_API int lua_resetthread (lua_State *L) {
return lua_closethread(L, NULL);
}
LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
int i;
lua_State *L;

View File

@ -20,10 +20,6 @@
#include "lauxlib.h"
#include "lualib.h"
/** Pi-hole modification **/
#include "ftl_lua.h"
/**************************/
#if !defined(LUA_PROGNAME)
#define LUA_PROGNAME "lua"
@ -215,9 +211,7 @@ static int dostring (lua_State *L, const char *s, const char *name) {
/*
** Receives 'globname[=modname]' and runs 'globname = require(modname)'.
*/
/************** Pi-hole modification ***************/
int dolibrary (lua_State *L, char *globname) {
/***************************************************/
static int dolibrary (lua_State *L, char *globname) {
int status;
char *modname = strchr(globname, '=');
if (modname == NULL) /* no explicit name? */
@ -645,12 +639,6 @@ static int pmain (lua_State *L) {
if (handle_luainit(L) != LUA_OK) /* run LUA_INIT */
return 0; /* error running LUA_INIT */
}
/************** Pi-hole modification ***************/
// Load and enable libraries bundled with Pi-hole
ftl_lua_init(L);
/***************************************************/
if (!runargs(L, argv, optlim)) /* execute arguments -e and -l */
return 0; /* something failed */
if (script > 0) { /* execute main script (if there is one) */
@ -671,9 +659,7 @@ static int pmain (lua_State *L) {
}
/******* Pi-hole modification ********/
int lua_main (int argc, char **argv) {
/*************************************/
int main (int argc, char **argv) {
int status, result;
lua_State *L = luaL_newstate(); /* create state */
if (L == NULL) {

View File

@ -18,10 +18,10 @@
#define LUA_VERSION_MAJOR "5"
#define LUA_VERSION_MINOR "4"
#define LUA_VERSION_RELEASE "5"
#define LUA_VERSION_RELEASE "6"
#define LUA_VERSION_NUM 504
#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 5)
#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 6)
#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
@ -163,7 +163,8 @@ extern const char lua_ident[];
LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);
LUA_API void (lua_close) (lua_State *L);
LUA_API lua_State *(lua_newthread) (lua_State *L);
LUA_API int (lua_resetthread) (lua_State *L, lua_State *from);
LUA_API int (lua_closethread) (lua_State *L, lua_State *from);
LUA_API int (lua_resetthread) (lua_State *L); /* Deprecated! */
LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);

View File

@ -193,9 +193,7 @@ static int pmain(lua_State* L)
return 0;
}
/******* Pi-hole modification ********/
int luac_main(int argc, char* argv[])
/*************************************/
int main(int argc, char* argv[])
{
lua_State* L;
int i=doargs(argc,argv);

View File

@ -44,10 +44,6 @@ LUAMOD_API int (luaopen_debug) (lua_State *L);
#define LUA_LOADLIBNAME "package"
LUAMOD_API int (luaopen_package) (lua_State *L);
/************ Pi-hole modification *************/
#define LUA_PIHOLELIBNAME "pihole"
LUAMOD_API int (luaopen_pihole) (lua_State *L);
/***********************************************/
/* open all previous libraries */
LUALIB_API void (luaL_openlibs) (lua_State *L);