summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swiftob/LuaCommands.cpp9
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);