Sophie

Sophie

distrib > Mandriva > 2009.1 > x86_64 > by-pkgid > ae725b411a33d298255218ea304f01e6 > files > 3

lua5.0-5.0.3-8mdv2009.1.src.rpm

--- lua-5.0.2.orig/lib/default.lua	1969-12-31 21:00:00.000000000 -0300
+++ lua-5.0.2/lib/default.lua	2004-04-22 11:57:57.000000000 -0300
@@ -0,0 +1,29 @@
+if not _REQUIREDNAME then
+  error('Don\'t load directly, use require "LibName"', 2)
+end
+
+-- Get libname.
+local libname  = os.getenv "LUA_SOPATH"
+if libname then
+  if not string.find(libname, '/$') then
+    libname = libname .. "/"
+  end
+else
+  libname = "/usr/lib/lua/5.0/"
+end
+libname = libname .. _REQUIREDNAME .. ".so"
+
+local funcname = "luaopen_" .. _REQUIREDNAME
+
+local f, err = loadlib(libname, funcname)
+if not f then
+  error("loadlib('" .. libname .. "', '" .. funcname .. "') failed: " .. err, 2)
+end
+
+local function ret(s, ...)
+  if s then
+    return unpack(arg)
+  end
+  error(_REQUIREDNAME .. "'s " .. funcname .. " failed: " .. arg[1], 3)
+end
+return ret(pcall(f))