diff options
| author | 2025-12-07 12:44:18 +0100 | |
|---|---|---|
| committer | 2025-12-07 12:44:18 +0100 | |
| commit | 6a335e2b7d47afdb5e37034a095aaa26a34d7ee1 (patch) | |
| tree | b7aae9d679df13ce04f695670e80a8e7a73361c9 /test/external/lua-5.4.0-tests/libs/lib2.c | |
| parent | bfc6b66078ab3ec543b8355ad22df1c423bf9a8c (diff) | |
Add lua 5.4.0 test suite
Diffstat (limited to 'test/external/lua-5.4.0-tests/libs/lib2.c')
| -rw-r--r-- | test/external/lua-5.4.0-tests/libs/lib2.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/external/lua-5.4.0-tests/libs/lib2.c b/test/external/lua-5.4.0-tests/libs/lib2.c new file mode 100644 index 0000000..bc9651e --- /dev/null +++ b/test/external/lua-5.4.0-tests/libs/lib2.c @@ -0,0 +1,23 @@ +#include "lua.h" +#include "lauxlib.h" + +static int id (lua_State *L) { + return lua_gettop(L); +} + + +static const struct luaL_Reg funcs[] = { + {"id", id}, + {NULL, NULL} +}; + + +LUAMOD_API int luaopen_lib2 (lua_State *L) { + lua_settop(L, 2); + lua_setglobal(L, "y"); /* y gets 2nd parameter */ + lua_setglobal(L, "x"); /* x gets 1st parameter */ + luaL_newlib(L, funcs); + return 1; +} + + |