[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Lua5.4-beta luaopen_package leaves CLIBS table on stack
- From: Stefan <ste@...>
- Date: Thu, 20 Feb 2020 00:49:23 +0100
Hello,
I'm not sure if it even matters since lua_call(L, 1, 1) in
luaL_requiref:951 deletes it anyways, but it seems that the
createclibstable function in loadlib.c forgets a value
on the stack due to the change from lua_newtable +
lua_rawsetp to luaL_getsubtable in 5.3.5 -> 5.4 beta.
test.c:
#include <stdio.h>
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
int main() {
lua_State* L = luaL_newstate();
printf("%d\n", lua_gettop(L));
luaopen_package(L);
printf("%d\n", lua_gettop(L));
}
$ gcc -Ilua-5.3.5/src/ test.c lua-5.3.5/src/liblua.a -ldl -lm && a.out
0
1
$ gcc -Ilua-5.4.0-beta/src/ test.c lua-5.4.0-beta/src/liblua.a -ldl -lm
&& a.out
0
2
Stefan