diff options
author | Kevin Smith <git@kismith.co.uk> | 2012-07-28 08:29:21 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-07-28 08:29:21 (GMT) |
commit | ca3044becf1192be24ec7006c9a46040502662fa (patch) | |
tree | cee5a41ce99beacca32ce5258f4e966f6168b0df | |
parent | ca5c7b0a957e651b12083a43e700a19d54fd1016 (diff) | |
download | swift-contrib-ca3044becf1192be24ec7006c9a46040502662fa.zip swift-contrib-ca3044becf1192be24ec7006c9a46040502662fa.tar.bz2 |
Get luasocket working in Swiftob
For this to work, you'll need to copy the luasocket .lua files into the folder from which you run Swiftob:
sigsegv:swift/swift/Swiftob/> ls *.lua 9:28am
ltn12.lua mime.lua socket.lua
sigsegv:swift/swift/Swiftob/> ls socket 9:28am
ftp.lua http.lua smtp.lua tp.lua url.lua
-rw-r--r-- | Swiftob/LuaCommands.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Swiftob/LuaCommands.cpp b/Swiftob/LuaCommands.cpp index bf43067..d2f0f07 100644 --- a/Swiftob/LuaCommands.cpp +++ b/Swiftob/LuaCommands.cpp @@ -410,8 +410,13 @@ void LuaCommands::loadScript(boost::filesystem::path filePath) { luaL_openlibs(lua); #ifdef LUA_HAVE_SOCKET - luaopen_socket_core(lua); - luaopen_mime_core(lua); + lua_getglobal(lua, "package"); + lua_getfield(lua, -1, "preload"); + lua_pushcfunction(lua, luaopen_socket_core); + lua_setfield(lua, -2, "socket.core"); + lua_pushcfunction(lua, luaopen_mime_core); + lua_setfield(lua, -2, "mime.core"); + lua_pop(lua, 2); #endif lua_pushlightuserdata(lua, this); |