Ok, I hacked away a bit, it's not pretty, but I got it to work in MSW. I downloaded the sources for luasocket-2.0.tar.gz. Compiled it using MSVC 2005 express using the sln file, I had to edit the *.vcproj to point to wxLua/module/lua/include for the include path to lua.h.
I edited mime.h/c and added MIME_API int luaopen_mime(lua_State *L); MIME_API int luaopen_mime(lua_State *L) { return luaopen_mime_core(L); } edited socket.h/c and added LUASOCKET_API int luaopen_socket(lua_State *L); LUASOCKET_API int luaopen_socket(lua_State *L) { return luaopen_socket_core(L); } *** I don't know why I have to do that? I then created a dir called "socket" and "mime" in the luasocket-2.0/src dir and copied (not moved) all the lua files into them. I moved src/mime.dll to src/mime/core.dll and src/socket.dll to src/socket/core.dll. You HAVE TO either delete src/socket.dll and src/mime.dll or get rid of them somehow, otherwise require tries to load them instead of mime.lua and socket.lua and they have to both be called core.dll. src/mime.lua -- these two are already there, leave others too src/socket.lua src/mime/core.dll src/socket/core.dll src/socket/ftp.lua src/socket/http.lua src/socket/smtp.lua src/socket/socket.lua src/socket/tp.lua src/socket/url.lua I edited src/compat/compat5.1r4/compat5.1.lua to have this package.cpath = os.getenv("LUA_CPATH") or "./?.dll;" .. instead of ?.so for unix systems. I could have just used the environment variables, but after some debugging about why it couldn't find the libs I just left it the way I had it. It works! Both using the lua.exe program and wxlua.exe. I ran the programs from the luasocket-2.0/src dir like this ../../wxLua/bin/wxlua.exe wxlua_socket.lua (the name I gave your program) (note also I'm using cygwin in Windows so I use forward slashes) I made some tweaks to wxLua.exe to make it handle the errors a little better. I'm not sure that this helps at all since I really just trashed things, but the problem you have is with the paths not being right and it not being able to find either the lua or dll files for the module's require. To help debug things change src/compat/compat5.1r4/compat5.1.lua At the top add the "print" to this list of functions local print, assert, error, getfenv, ipairs, loadfile, loadlib, pairs, setfenv, setmetatable, type = print, assert, error, getfenv, ipairs, loadfile, loadlib, pairs, setfenv, setmetatable, type then later on add some "print" statements local function search (path, name) ... print("search ", c) local function loader_C (name) print("loader_C ", name) local function loader_Lua (name) print("loader_Lua ", name) and whatever else seems necessary to help you understand why it cannot find what it's looking for. Good luck, John Labenski On 2/27/06, John Labenski <[EMAIL PROTECTED]> wrote: > On 2/27/06, Marcos <[EMAIL PROTECTED]> wrote: > > I'm compiling wxlua myself. > > I'am using the luasocket 2.0 binary files on win32 (win98). > > > > > I see you load compat-5.1.lua, wxLua is based on 5.0.2, has luasocket > > > been compiled for 5.1? > > No, luasocket was been compiled for 5.0.2, but under compat-5.1 package > > model. > > > > I download your wxLua installer e try ... > > > > the script is: > > --- > > dofile([[D:\lua\lua5\5.0\bin\compat-5.1.lua]] ) > > local http = require("socket.http") > > print(http.request) > > b, c, h = http.request("http://www.lua.org") print(b,c,h) > > --- > > > > I get this message with lua.exe and wxlua.exe > > --- > > wxLua: Error while running chunk > > compat-5.1.lua:130: error loading package `socket.core' (One of the > > library files needed to run this application cannot be found. > > ) > > --- > > > > Now I put lua50.dll (luasocket dependencie ) in /bin, and get this. > > ---- > > C:\App\wxLua\test\socket>C:\App\wxLua\bin\lua.exe http1.lua > > function: 00AC4780 > > C:\APP\WXLUA\BIN\LUA.EXE: not enough memory > > stack traceback: > > [C]: in function `request' > > http1.lua:4: in main chunk > > [C]: ? > > --- > > > > Note the module was loaded and http.request is a function. > > Well, it seems a little closer. I've tried it in linux, I got the > luasocket source compiled it, but I had to make some changes, but it > still doesn't even work using the lua executable. > > luasocket.h & luasocket.c I added > > LUASOCKET_API int luaopen_socket(lua_State *L); > > LUASOCKET_API int luaopen_socket(lua_State *L) { > return luaopen_socket_core(L); > } > > since otherwise I got this error when just running it in lua > ../../wxLua/bin/lua: > .../wxLua/luasocket-2.0/src/compat-5.1r4/compat-5.1.lua:125: error > loading package `socket' (./socket.so: undefined symbol: > luaopen_socket) > > I tried changing the require code to > local http = require("socket") > > to not get the error > ../../wxLua/bin/lua: > .../wxLua/luasocket-2.0/src/compat-5.1r4/compat-5.1.lua:171: package > `socket.http' not found > > but now I get this error, since it didn't load the http module. > ../../wxLua/bin/lua: wxlua_test.lua:9: attempt to call field `request' > (a nil value) > > I'm a little unfamiliar with the module way of doing things, but > something not right about the luasocket lib or my paths or... > something. I'm a little suspicious since it was looking for a function > called luaopen_socket which didn't even exist, so I think there may be > other problems in the luasocket module. > > It would be nice to get this working in wxLua, but if I can't even get > it to work using lua, I won't be able to make any progress. I'll try > tomorrow in MSW. > > Regards, > John Labenski > ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642 _______________________________________________ Wxlua-users mailing list Wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users