1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
-- Lua socket autoloader for Debian
-- Use this with require "luasocket";
if( loadlib == nil ) then
error( "Unable to load LuaSocket library. No Loadlib found" );
end
local libfile = "/usr/lib/libluasocket.so.2";
local funcname = "luaopen_socket";
local func,os_err,canonical_err;
func, os_err, canonical_err = loadlib( libfile, funcname );
if( not func ) then
if( canonical_err == "absent" ) then
error( "Unable to load LuaSocket library. Lua built without loadlib." );
end
if( canonical_err == "init" ) then
error( "Luasocket library ("..libfile..") is missing init function ("..funcname..")\nOS said: "..os_err);
end
if( canonical_err == "open" ) then
error( "Luasocket library ("..libfile..") cannot be loaded.\nOS said: "..os_err);
end
end
-- Luasocket library loaded, call it...
func();
if not LUASOCKET_LIBNAME then
error("LuaSocket initialisation failed")
end
|