File 'lib2-v2.so' generated from its own source
Instead of being a copy of 'lib2.so', 'lib2-v2.so' has its own source
file ('lib22.c'), so that the test can distinguish both libraries.
diff --git a/testes/attrib.lua b/testes/attrib.lua
index 4adb42e..b1a4a19 100644
--- a/testes/attrib.lua
+++ b/testes/attrib.lua
@@ -275,7 +275,7 @@
-- check correct access to global environment and correct
-- parameters
assert(_ENV.x == "lib2-v2" and _ENV.y == DC"lib2-v2")
- assert(lib2.id("x") == "x")
+ assert(lib2.id("x") == true) -- a different "id" implementation
-- test C submodules
local fs, ext = require"lib1.sub"
diff --git a/testes/libs/lib22.c b/testes/libs/lib22.c
new file mode 100644
index 0000000..8e65650
--- /dev/null
+++ b/testes/libs/lib22.c
@@ -0,0 +1,25 @@
+#include "lua.h"
+#include "lauxlib.h"
+
+static int id (lua_State *L) {
+ lua_pushboolean(L, 1);
+ lua_insert(L, 1);
+ 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;
+}
+
+
diff --git a/testes/libs/makefile b/testes/libs/makefile
index acff484..698f898 100644
--- a/testes/libs/makefile
+++ b/testes/libs/makefile
@@ -23,5 +23,5 @@
lib21.so: lib21.c $(LUA_DIR)/luaconf.h $(LUA_DIR)/ltests.h
$(CC) $(CFLAGS) -o lib21.so lib21.c
-lib2-v2.so: lib2.so
- cp lib2.so ./lib2-v2.so
+lib2-v2.so: lib21.c $(LUA_DIR)/luaconf.h $(LUA_DIR)/ltests.h
+ $(CC) $(CFLAGS) -o lib2-v2.so lib22.c