Closed sage-etcher closed 4 months ago
LGTM and looks useful, ty!
It's unneeded, however, I realized after the fact that I overcomplicated this a bit. I have a simplified (slightly faster) version of this patch as well; I'd forgot to commit it earlier. Would that be something you'd be interested in?
Instead of using the lua_pop
macro and a second call to lua_gettop
, it manually sets the top, saving a function call and quite a few computations by using
lua_settop(L, top+1);
I think it's also a bit clearer what is going on, for example in an edge-case where require
doesn't push anything. In such scenario, previous implementation would say lua_pop(-1)
which would push a value onto the stack to align the data, which works but is unclear. However lua_settop
is clearer in that it will always make sure the data is aligned by +1
.
Sure why not, feel free to submit it:)
Awesome's
-v
version flag, was written with Lua53'srequire
in mind, which only returns 1 value. However, in Lua54, therequire
built-in now returns 2 values. Awesome doesn't handle this causing the version information to display incorrectly.Rather than checking
LUA_VERSION_NUM
, the patch handles this at runtime, so no matter the version of Lua used at build time, the runtime information should be correct for the given Lua + LGI softwares.I tested the patch with Lua versions:
5.4.3
,5.3.5
, and5.3.6
, and it works in each.Example (w/o the patch) running Lua 5.4.3 and LGI-GIT:
Example (w/ the patch)
The patch isn't essential, Awesome will run fine without it, but it's nice having the version information not be wrong ://
for Issue #128