lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi Joseph,

thanks for your answer! Is it still possible to get nres in the old way?

The problem is, httpd is not possible to build with new Lua 5.4, since in mod_lua
there are like 5 lua_resume calls. There is already macro:

#define lua_resume(a,b)    lua_resume(a, NULL, b)

Is there any chance, to solve this issue only by using macro? Something like:

#if LUA_VERSION_NUM > 503
#define lua_resume(a,b)    lua_resume(a, NULL, b, NULL)
#else
#define lua_resume(a,b)    lua_resume(a, NULL, b)
#endif


lua_gettop(L) is in the code used like 7 times and it is far away from lua_resume
function calls, so I suppose it won't be so easy to rewrite it, if lua_gettop can NOT
be used anymore. Or is it possible to use lua_gettop like in version 5.3 and pass NULL to the
fourth param, as I mentioned above?

Best,

----- Original Message -----
> From: "Joseph C. Sible" <josephcsible@gmail.com>
> To: "Lua mailing list" <lua-l@lists.lua.org>
> Sent: Thursday, July 9, 2020 8:31:33 PM
> Subject: Re: New param in lua_resume in Lua 5.4
> 
> On Thu, Jul 9, 2020 at 11:46 AM Lubos Uhliarik <luhliari@redhat.com> wrote:
> >
> > I just found out, that there has been added new param to function
> > lua_resume.
> >
> > New definition in Lua 5.4 is following:
> >
> > int lua_resume (lua_State *L, lua_State *from, int nargs,
> >                           int *nresults);
> >
> >
> > Do you have any idea, how I need to rewrite the code, if in old code we use
> > just
> > lua_resume(L, NULL, x) ?
> 
> It depends on the context of the code around it. Basically, wherever
> you used lua_gettop(L) before, you want to use nres from the out
> parameter now. For example, if you had this before:
> 
> /* set up for the call to lua_resume */
> int status = lua_resume(L, NULL, x);
> /* check status */
> int nres = lua_gettop(L);
> /* do stuff with nres */
> 
> Then you'd want to do this now:
> 
> /* set up for the call to lua_resume */
> int nres;
> int status = lua_resume(L, NULL, x, &nres);
> /* check status */
> /* do stuff with nres */
> 
> Joseph C. Sible
> 
> 

-- 
Lubos Uhliarik
Software Engineer - EMEA ENG Developer Experience
RH - Brno - TPB-C - 1D221
IRC: zero_byte at irc.freenode.net

RED HAT | TRIED. TESTED. TRUSTED.
Every airline in the Fortune 500 relies on Red Hat.
Find out why at http://www.redhat.com/en/about/trusted

Red Hat Inc. http://cz.redhat.com