From 402b97fbdf4857adc5aa80f85fa5e59148e126b7 Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Thu, 19 Sep 2024 00:43:31 +0200 Subject: Added debuggers to Nix shell --- zig-lua/lua-5.4.7/testes/libs/lib2.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 zig-lua/lua-5.4.7/testes/libs/lib2.c (limited to 'zig-lua/lua-5.4.7/testes/libs/lib2.c') diff --git a/zig-lua/lua-5.4.7/testes/libs/lib2.c b/zig-lua/lua-5.4.7/testes/libs/lib2.c new file mode 100644 index 0000000..bc9651e --- /dev/null +++ b/zig-lua/lua-5.4.7/testes/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; +} + + -- cgit v1.2.3